diff --git a/instrumentation/thrift/thrift-0.14.0-testing/build.gradle.kts b/instrumentation/thrift/thrift-0.14.0-testing/build.gradle.kts new file mode 100644 index 000000000000..ff2a970a36b9 --- /dev/null +++ b/instrumentation/thrift/thrift-0.14.0-testing/build.gradle.kts @@ -0,0 +1,12 @@ +plugins { + id("otel.javaagent-testing") +} + +dependencies { + testImplementation("org.apache.thrift:libthrift:0.14.0") + testImplementation("javax.annotation:javax.annotation-api:1.3.2") + + implementation(project(":instrumentation:thrift:thrift-0.9.1:javaagent")) { + exclude("org.apache.thrift", "libthrift") + } +} diff --git a/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/NoReturnTest.java b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/NoReturnTest.java new file mode 100644 index 000000000000..ee9d1da68de3 --- /dev/null +++ b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/NoReturnTest.java @@ -0,0 +1,985 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_14_0; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_14_0.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.apache.thrift.transport.layered.TFramedTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class NoReturnTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerNoReturn() throws TException { + this.startSyncSimpleServer(this.port); + this.syncClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncClientSyncSimpleServerNoReturnMuti() throws TException { + this.startSyncSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientNoReturn(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("noReturn", 5); + } + + @Test + public void syncClientSyncSimpleServerNoReturnParallel() throws TException, InterruptedException { + this.startSyncSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientNoReturn(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerNoReturnParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("noReturn", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerNoReturn() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncClientSyncThreadPoolServerNoReturnMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientNoReturn(port); + } + this.waitAndAssertTracesClientSyncServerSync("noReturn", 5); + } + + @Test + public void syncClientSyncThreadPoolServerNoReturnParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientNoReturn(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerNoReturnParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("noReturn", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerNoReturn() throws TException { + this.startMultiSimpleServer(this.port); + this.syncClientMultiNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", "syncHelloWorld:noReturn", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerNoReturnMuti() throws TException { + this.startMultiSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiNoReturn(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("noReturn", "syncHelloWorld:noReturn", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerNoReturnParallel() + throws TException, InterruptedException { + this.startMultiSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiNoReturn(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerNoReturnParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "noReturn", "syncHelloWorld:noReturn", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerNoReturnError() { + Exception error = null; + try { + this.startSyncThreadedSelectorServer(this.port); + this.syncClientNoReturn(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("noReturn", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerNoReturnError() { + Exception error = null; + try { + this.startAsyncThreadedSelectorServer(this.port); + this.syncClientNoReturn(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("noReturn", 1); + } + + @Test + public void syncNonblockingSaslClientSyncSaslNonblockingServerNoReturnError() { + Exception error = null; + try { + this.startSyncSaslNonblockingServer(this.port); + this.syncNonblockingSaslClientNoReturn(this.port); + } catch (IOException | TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerNoSasl("noReturn", 1); + } + + @Test + public void syncNonblockingSaslClientAsyncSaslNonblockingServerNoReturnError() { + Exception error = null; + try { + this.startAsyncSaslNonblockingServer(this.port); + this.syncNonblockingSaslClientNoReturn(this.port); + } catch (IOException | TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerNoSasl("noReturn", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerNoReturn() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + this.syncFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerNoReturnMuti() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientNoReturn(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerNoReturnParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientNoReturn(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerNoReturn() throws TException { + this.startMultiThreadedSelectorServer(this.port); + this.syncFramedClientMultiNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", "syncHelloWorld:noReturn", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerNoReturnMuti() throws TException { + this.startMultiThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiNoReturn(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("noReturn", "syncHelloWorld:noReturn", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerNoReturnParallel() + throws TException, InterruptedException { + this.startMultiThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiNoReturn(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "noReturn", "syncHelloWorld:noReturn", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerNoReturn() throws TException { + this.startSyncThreadedSelectorServer(this.port); + this.syncFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerNoReturnMuti() throws TException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientNoReturn(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("noReturn", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerNoReturnParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientNoReturn(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("noReturn", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerNoReturn() throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + this.nonBlockClientNoReturn(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerNoReturnMuti() + throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientNoReturn(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerNoReturnParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientNoReturn(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerNoReturn() throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + this.nonBlockClientNoReturn(this.port); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerNoReturnMuti() + throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientNoReturn(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerNoReturnParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientNoReturn(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerNoReturn() throws TException { + this.startSyncNonblockingServer(this.port); + this.syncFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerNoReturnMuti() throws TException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientNoReturn(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("noReturn", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerNoReturnParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientNoReturn(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("noReturn", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerNoReturn() throws TException { + this.startSyncHsHaServer(this.port); + this.syncFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerNoReturnMuti() throws TException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientNoReturn(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("noReturn", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerNoReturnParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientNoReturn(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("noReturn", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerNoReturn() throws TException { + this.startAsyncNonblockingServer(this.port); + this.syncFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerNoReturnMuti() throws TException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientNoReturn(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerNoReturnParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientNoReturn(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerNoReturn() throws TException { + this.startAsyncHsHaServer(this.port); + this.syncFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerNoReturnMuti() throws TException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientNoReturn(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerNoReturnParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientNoReturn(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerNoReturn() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + this.nonBlockClientNoReturn(this.port); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerNoReturnMuti() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientNoReturn(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerNoReturnParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientNoReturn(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerNoReturn() throws TException, IOException { + this.startSyncHsHaServer(this.port); + this.nonBlockClientNoReturn(this.port); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerNoReturnMuti() throws TException, IOException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientNoReturn(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerNoReturnParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientNoReturn(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerNoReturnError() { + Exception error = null; + try { + this.startAsyncNonblockingServer(this.port); + this.syncClientNoReturn(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("noReturn", 1); + } + + @Test + public void syncClientSyncNonblockingServerNoReturnError() { + Exception error = null; + try { + this.startSyncNonblockingServer(this.port); + this.syncClientNoReturn(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("noReturn", 1); + } + + @Test + public void syncClientAsyncHsHaServerNoReturnError() { + Exception error = null; + try { + this.startAsyncHsHaServer(this.port); + this.syncClientNoReturn(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("noReturn", 1); + } + + @Test + public void syncClientSyncHsHaServerNoReturnError() { + Exception error = null; + try { + this.startSyncHsHaServer(this.port); + this.syncClientNoReturn(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("noReturn", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerNoReturn() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + this.nonBlockClientNoReturn(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerNoReturnMuti() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientNoReturn(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerNoReturnParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientNoReturn(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerNoReturn() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + this.nonBlockClientNoReturn(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerNoReturnMuti() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientNoReturn(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerNoReturnParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientNoReturn(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", threadCount); + } + + public void syncClientNoReturn(int port) throws TException { + try (TTransport transport = new TSocket("localhost", port)) { + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.noReturn(1)); + } + } + + public void syncClientMultiNoReturn(int port) throws TException { + try (TTransport transport = new TSocket("localhost", port)) { + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + this.testing().runWithSpan("parent", () -> client.noReturn(1)); + } + } + + public void nonBlockClientNoReturn(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(Void s) {} + + @Override + public void onError(Exception e) { + throw new VerifyException("nonBlockClientNoReturn test failed", e); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.noReturn(1, callback)); + } + + public void syncFramedClientNoReturn(int port) throws TException { + try (TSocket tSocket = new TSocket("localhost", port)) { + TFramedTransport framedTransport = new TFramedTransport(tSocket); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.noReturn(1)); + } + } + + public void syncFramedClientMultiNoReturn(int port) throws TException { + try (TSocket tSocket = new TSocket("localhost", port)) { + TFramedTransport framedTransport = new TFramedTransport(tSocket); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + this.testing().runWithSpan("parent", () -> client.noReturn(1)); + } + } + + public void syncNonblockingSaslClientNoReturn(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.noReturn(1)); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/OneWayErrorTest.java b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/OneWayErrorTest.java new file mode 100644 index 000000000000..7c0bf68187e9 --- /dev/null +++ b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/OneWayErrorTest.java @@ -0,0 +1,998 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_14_0; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_14_0.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.apache.thrift.transport.layered.TFramedTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class OneWayErrorTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerOneWayWithError() throws TException { + this.startSyncSimpleServer(this.port); + this.syncClientOneWayWithError(this.port); + this.waitAndAssertTracesClientSyncServerSync("oneWayWithError", 1); + } + + @Test + public void syncClientSyncSimpleServerOneWayWithErrorMuti() throws TException { + this.startSyncSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientOneWayWithError(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("oneWayWithError", 5); + } + + @Test + public void syncClientSyncSimpleServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startSyncSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientOneWayWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWayWithError", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerOneWayWithError() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientOneWayWithError(port); + this.waitAndAssertTracesClientSyncServerSync("oneWayWithError", 1); + } + + @Test + public void syncClientSyncThreadPoolServerOneWayWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientOneWayWithError(port); + } + this.waitAndAssertTracesClientSyncServerSync("oneWayWithError", 5); + } + + @Test + public void syncClientSyncThreadPoolServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientOneWayWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWayWithError", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerOneWayWithError() throws TException { + this.startMultiSimpleServer(this.port); + this.syncClientMultiOneWayWithError(this.port); + this.waitAndAssertTracesClientSyncServerSync( + "oneWayWithError", "syncHelloWorld:oneWayWithError", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerOneWayWithErrorMuti() throws TException { + this.startMultiSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiOneWayWithError(this.port); + } + this.waitAndAssertTracesClientSyncServerSync( + "oneWayWithError", "syncHelloWorld:oneWayWithError", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startMultiSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiOneWayWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "oneWayWithError", "syncHelloWorld:oneWayWithError", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerOneWayWithErrorError() { + Exception error = null; + try { + this.startSyncThreadedSelectorServer(this.port); + this.syncClientOneWayWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWayWithError", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerOneWayWithErrorError() { + Exception error = null; + try { + this.startAsyncThreadedSelectorServer(this.port); + this.syncClientOneWayWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWayWithError", 1); + } + + @Test + public void syncNonblockingSaslClientSyncSaslNonblockingServerOneWayWithErrorError() { + Exception error = null; + try { + this.startSyncSaslNonblockingServer(this.port); + this.syncNonblockingSaslClientOneWayWithError(this.port); + } catch (IOException | TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerNoSasl("oneWayWithError", 1); + } + + @Test + public void syncNonblockingSaslClientAsyncSaslNonblockingServerOneWayWithErrorError() { + Exception error = null; + try { + this.startAsyncSaslNonblockingServer(this.port); + this.syncNonblockingSaslClientOneWayWithError(this.port); + } catch (IOException | TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerNoSasl("oneWayWithError", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerOneWayWithError() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + this.syncFramedClientOneWayWithError(this.port); + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerOneWayWithErrorMuti() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWayWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerOneWayWithError() throws TException { + this.startMultiThreadedSelectorServer(this.port); + this.syncFramedClientMultiOneWayWithError(this.port); + this.waitAndAssertTracesClientSyncServerSync( + "oneWayWithError", "syncHelloWorld:oneWayWithError", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerOneWayWithErrorMuti() + throws TException { + this.startMultiThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync( + "oneWayWithError", "syncHelloWorld:oneWayWithError", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startMultiThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiOneWayWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "oneWayWithError", "syncHelloWorld:oneWayWithError", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerOneWayWithError() throws TException { + this.startSyncThreadedSelectorServer(this.port); + this.syncFramedClientOneWayWithError(this.port); + this.waitAndAssertTracesClientSyncServerSync("oneWayWithError", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerOneWayWithErrorMuti() throws TException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("oneWayWithError", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWayWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWayWithError", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerOneWayWithError() + throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + this.nonBlockClientOneWayWithError(this.port); + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerOneWayWithErrorMuti() + throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWayWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerOneWayWithError() + throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + this.nonBlockClientOneWayWithError(this.port); + this.waitAndAssertTracesClientAsyncServerSync("oneWayWithError", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerOneWayWithErrorMuti() + throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("oneWayWithError", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWayWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("oneWayWithError", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWayWithError() throws TException { + this.startSyncNonblockingServer(this.port); + this.syncFramedClientOneWayWithError(this.port); + this.waitAndAssertTracesClientSyncServerSync("oneWayWithError", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWayWithErrorMuti() throws TException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("oneWayWithError", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWayWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWayWithError", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWayWithError() throws TException { + this.startSyncHsHaServer(this.port); + this.syncFramedClientOneWayWithError(this.port); + this.waitAndAssertTracesClientSyncServerSync("oneWayWithError", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWayWithErrorMuti() throws TException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("oneWayWithError", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWayWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWayWithError", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerOneWayWithError() throws TException { + this.startAsyncNonblockingServer(this.port); + this.syncFramedClientOneWayWithError(this.port); + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerOneWayWithErrorMuti() throws TException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWayWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerOneWayWithError() throws TException { + this.startAsyncHsHaServer(this.port); + this.syncFramedClientOneWayWithError(this.port); + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerOneWayWithErrorMuti() throws TException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWayWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWayWithError() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + this.nonBlockClientOneWayWithError(this.port); + this.waitAndAssertTracesClientAsyncServerSync("oneWayWithError", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWayWithErrorMuti() + throws TException, IOException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("oneWayWithError", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWayWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("oneWayWithError", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWayWithError() throws TException, IOException { + this.startSyncHsHaServer(this.port); + this.nonBlockClientOneWayWithError(this.port); + this.waitAndAssertTracesClientAsyncServerSync("oneWayWithError", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWayWithErrorMuti() throws TException, IOException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("oneWayWithError", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWayWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("oneWayWithError", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerOneWayWithErrorError() { + Exception error = null; + try { + this.startAsyncNonblockingServer(this.port); + this.syncClientOneWayWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWayWithError", 1); + } + + @Test + public void syncClientSyncNonblockingServerOneWayWithErrorError() { + Exception error = null; + try { + this.startSyncNonblockingServer(this.port); + this.syncClientOneWayWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWayWithError", 1); + } + + @Test + public void syncClientAsyncHsHaServerOneWayWithErrorError() { + Exception error = null; + try { + this.startAsyncHsHaServer(this.port); + this.syncClientOneWayWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWayWithError", 1); + } + + @Test + public void syncClientSyncHsHaServerOneWayWithErrorError() { + Exception error = null; + try { + this.startSyncHsHaServer(this.port); + this.syncClientOneWayWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWayWithError", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerOneWayWithError() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + this.nonBlockClientOneWayWithError(this.port); + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerOneWayWithErrorMuti() + throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWayWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerOneWayWithError() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + this.nonBlockClientOneWayWithError(this.port); + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerOneWayWithErrorMuti() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWayWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", threadCount); + } + + public void syncClientOneWayWithError(int port) throws TException { + try (TTransport transport = new TSocket("localhost", port)) { + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.oneWayWithError()); + } + } + + public void syncClientMultiOneWayWithError(int port) throws TException { + try (TTransport transport = new TSocket("localhost", port)) { + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + this.testing().runWithSpan("parent", () -> client.oneWayWithError()); + } + } + + public void nonBlockClientOneWayWithError(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(Void no) {} + + @Override + public void onError(Exception e) { + throw new VerifyException("nonBlockClientOneWayWithError test failed", e); + } + }; + this.testing() + .runWithSpan( + "parent", + () -> { + asyClient.oneWayWithError(callback); + }); + } + + public void syncFramedClientOneWayWithError(int port) throws TException { + TFramedTransport framedTransport = new TFramedTransport(new TSocket("localhost", port)); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.oneWayWithError()); + } + + public void syncFramedClientMultiOneWayWithError(int port) throws TException { + TFramedTransport framedTransport = new TFramedTransport(new TSocket("localhost", port)); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + this.testing().runWithSpan("parent", () -> client.oneWayWithError()); + } + + public void syncNonblockingSaslClientOneWayWithError(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.oneWayWithError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/OneWayTest.java b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/OneWayTest.java new file mode 100644 index 000000000000..8be39123c7ed --- /dev/null +++ b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/OneWayTest.java @@ -0,0 +1,975 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_14_0; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_14_0.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.apache.thrift.transport.layered.TFramedTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class OneWayTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerOneWay() throws TException { + this.startSyncSimpleServer(this.port); + this.syncClientOneWay(this.port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", 1); + } + + @Test + public void syncClientSyncSimpleServerOneWayMuti() throws TException { + this.startSyncSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientOneWay(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("oneWay", 5); + } + + @Test + public void syncClientSyncSimpleServerOneWayParallel() throws TException, InterruptedException { + this.startSyncSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientOneWay(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerOneWay() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientOneWay(port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", 1); + } + + @Test + public void syncClientSyncThreadPoolServerOneWayMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientOneWay(port); + } + this.waitAndAssertTracesClientSyncServerSync("oneWay", 5); + } + + @Test + public void syncClientSyncThreadPoolServerOneWayParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientOneWay(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerOneWay() throws TException { + this.startMultiSimpleServer(this.port); + this.syncClientMultiOneWay(this.port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", "syncHelloWorld:oneWay", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerOneWayMuti() throws TException { + this.startMultiSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiOneWay(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("oneWay", "syncHelloWorld:oneWay", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerOneWayParallel() + throws TException, InterruptedException { + this.startMultiSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiOneWay(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", "syncHelloWorld:oneWay", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerOneWayError() { + Exception error = null; + try { + this.startSyncThreadedSelectorServer(this.port); + this.syncClientOneWay(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWay", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerOneWayError() { + Exception error = null; + try { + this.startAsyncThreadedSelectorServer(this.port); + this.syncClientOneWay(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWay", 1); + } + + @Test + public void syncNonblockingSaslClientSyncSaslNonblockingServerOneWayError() { + Exception error = null; + try { + this.startSyncSaslNonblockingServer(this.port); + this.syncNonblockingSaslClientOneWay(this.port); + } catch (IOException | TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerNoSasl("oneWay", 1); + } + + @Test + public void syncNonblockingSaslClientAsyncSaslNonblockingServerOneWayError() { + Exception error = null; + try { + this.startAsyncSaslNonblockingServer(this.port); + this.syncNonblockingSaslClientOneWay(this.port); + } catch (IOException | TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerNoSasl("oneWay", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerOneWay() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + this.syncFramedClientOneWay(this.port); + this.waitAndAssertTracesClientSyncServerAsync("oneWay", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerOneWayMuti() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWay(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("oneWay", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerOneWayParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWay(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("oneWay", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerOneWay() throws TException { + this.startMultiThreadedSelectorServer(this.port); + this.syncFramedClientMultiOneWay(this.port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", "syncHelloWorld:oneWay", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerOneWayMuti() throws TException { + this.startMultiThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiOneWay(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("oneWay", "syncHelloWorld:oneWay", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerOneWayParallel() + throws TException, InterruptedException { + this.startMultiThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiOneWay(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", "syncHelloWorld:oneWay", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerOneWay() throws TException { + this.startSyncThreadedSelectorServer(this.port); + this.syncFramedClientOneWay(this.port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerOneWayMuti() throws TException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWay(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("oneWay", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerOneWayParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWay(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerOneWay() throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + this.nonBlockClientOneWay(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerOneWayMuti() throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWay(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerOneWayParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWay(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerOneWay() throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + this.nonBlockClientOneWay(this.port); + this.waitAndAssertTracesClientAsyncServerSync("oneWay", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerOneWayMuti() throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWay(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("oneWay", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerOneWayParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWay(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("oneWay", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWay() throws TException { + this.startSyncNonblockingServer(this.port); + this.syncFramedClientOneWay(this.port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWayMuti() throws TException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWay(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("oneWay", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWayParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWay(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWay() throws TException { + this.startSyncHsHaServer(this.port); + this.syncFramedClientOneWay(this.port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWayMuti() throws TException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWay(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("oneWay", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWayParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWay(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerOneWay() throws TException { + this.startAsyncNonblockingServer(this.port); + this.syncFramedClientOneWay(this.port); + this.waitAndAssertTracesClientSyncServerAsync("oneWay", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerOneWayMuti() throws TException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWay(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("oneWay", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerOneWayParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWay(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("oneWay", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerOneWay() throws TException { + this.startAsyncHsHaServer(this.port); + this.syncFramedClientOneWay(this.port); + this.waitAndAssertTracesClientSyncServerAsync("oneWay", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerOneWayMuti() throws TException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWay(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("oneWay", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerOneWayParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWay(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("oneWay", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWay() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + this.nonBlockClientOneWay(this.port); + this.waitAndAssertTracesClientAsyncServerSync("oneWay", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWayMuti() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWay(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("oneWay", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWayParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWay(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("oneWay", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWay() throws TException, IOException { + this.startSyncHsHaServer(this.port); + this.nonBlockClientOneWay(this.port); + this.waitAndAssertTracesClientAsyncServerSync("oneWay", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWayMuti() throws TException, IOException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWay(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("oneWay", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWayParallel() throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWay(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("oneWay", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerOneWayError() { + Exception error = null; + try { + this.startAsyncNonblockingServer(this.port); + this.syncClientOneWay(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWay", 1); + } + + @Test + public void syncClientSyncNonblockingServerOneWayError() { + Exception error = null; + try { + this.startSyncNonblockingServer(this.port); + this.syncClientOneWay(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWay", 1); + } + + @Test + public void syncClientAsyncHsHaServerOneWayError() { + Exception error = null; + try { + this.startAsyncHsHaServer(this.port); + this.syncClientOneWay(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWay", 1); + } + + @Test + public void syncClientSyncHsHaServerOneWayError() { + Exception error = null; + try { + this.startSyncHsHaServer(this.port); + this.syncClientOneWay(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWay", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerOneWay() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + this.nonBlockClientOneWay(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerOneWayMuti() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWay(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerOneWayParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWay(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerOneWay() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + this.nonBlockClientOneWay(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerOneWayMuti() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWay(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerOneWayParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWay(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", threadCount); + } + + public void syncClientOneWay(int port) throws TException { + try (TTransport transport = new TSocket("localhost", port)) { + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.oneWay()); + } + } + + public void syncClientMultiOneWay(int port) throws TException { + try (TTransport transport = new TSocket("localhost", port)) { + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + this.testing().runWithSpan("parent", () -> client.oneWay()); + } + } + + public void nonBlockClientOneWay(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(Void no) {} + + @Override + public void onError(Exception e) { + throw new VerifyException("nonBlockClientOneWay test failed", e); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.oneWay(callback)); + } + + public void syncFramedClientOneWay(int port) throws TException { + TFramedTransport framedTransport = new TFramedTransport(new TSocket("localhost", port)); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.oneWay()); + } + + public void syncFramedClientMultiOneWay(int port) throws TException { + TFramedTransport framedTransport = new TFramedTransport(new TSocket("localhost", port)); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + this.testing().runWithSpan("parent", () -> client.oneWay()); + } + + public void syncNonblockingSaslClientOneWay(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.oneWay()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/SayHelloTest.java b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/SayHelloTest.java new file mode 100644 index 000000000000..08fc3dab20e0 --- /dev/null +++ b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/SayHelloTest.java @@ -0,0 +1,991 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_14_0; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_14_0.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.apache.thrift.transport.layered.TFramedTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class SayHelloTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerSayHello() throws TException { + this.startSyncSimpleServer(this.port); + this.syncClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncClientSyncSimpleServerSayHelloMuti() throws TException { + this.startSyncSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientSayHello(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("sayHello", 5); + } + + @Test + public void syncClientSyncSimpleServerSayHelloParallel() throws TException, InterruptedException { + this.startSyncSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientSayHello(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("sayHello", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerSayHello() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncClientSyncThreadPoolServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientSayHello(port); + } + this.waitAndAssertTracesClientSyncServerSync("sayHello", 5); + } + + @Test + public void syncClientSyncThreadPoolServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientSayHello(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("sayHello", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerSayHello() throws TException { + this.startMultiSimpleServer(this.port); + this.syncClientMultiSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", "syncHelloWorld:sayHello", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerSayHelloMuti() throws TException { + this.startMultiSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiSayHello(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("sayHello", "syncHelloWorld:sayHello", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerSayHelloParallel() + throws TException, InterruptedException { + this.startMultiSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiSayHello(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "sayHello", "syncHelloWorld:sayHello", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerSayHelloError() { + Exception error = null; + try { + this.startSyncThreadedSelectorServer(this.port); + this.syncClientSayHello(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("sayHello", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerSayHelloError() { + Exception error = null; + try { + this.startAsyncThreadedSelectorServer(this.port); + this.syncClientSayHello(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("sayHello", 1); + } + + @Test + public void syncNonblockingSaslClientSyncSaslNonblockingServerSayHelloError() { + Exception error = null; + try { + this.startSyncSaslNonblockingServer(this.port); + this.syncNonblockingSaslClientSayHello(this.port); + } catch (IOException | TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerNoSasl("sayHello", 1); + } + + @Test + public void syncNonblockingSaslClientAsyncSaslNonblockingServerSayHelloError() { + Exception error = null; + try { + this.startAsyncSaslNonblockingServer(this.port); + this.syncNonblockingSaslClientSayHello(this.port); + } catch (IOException | TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerNoSasl("sayHello", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerSayHello() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + this.syncFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerSayHelloMuti() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientSayHello(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientSayHello(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerSayHello() throws TException { + this.startMultiThreadedSelectorServer(this.port); + this.syncFramedClientMultiSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", "syncHelloWorld:sayHello", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerSayHelloMuti() throws TException { + this.startMultiThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiSayHello(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("sayHello", "syncHelloWorld:sayHello", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + this.startMultiThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiSayHello(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "sayHello", "syncHelloWorld:sayHello", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerSayHello() throws TException { + this.startSyncThreadedSelectorServer(this.port); + this.syncFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerSayHelloMuti() throws TException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientSayHello(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("sayHello", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientSayHello(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("sayHello", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerSayHello() throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + this.nonBlockClientSayHello(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerSayHelloMuti() + throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientSayHello(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientSayHello(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerSayHello() throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + this.nonBlockClientSayHello(this.port); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerSayHelloMuti() + throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientSayHello(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientSayHello(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHello() throws TException { + this.startSyncNonblockingServer(this.port); + this.syncFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHelloMuti() throws TException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientSayHello(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("sayHello", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientSayHello(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("sayHello", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHello() throws TException { + this.startSyncHsHaServer(this.port); + this.syncFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHelloMuti() throws TException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientSayHello(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("sayHello", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientSayHello(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("sayHello", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerSayHello() throws TException { + this.startAsyncNonblockingServer(this.port); + this.syncFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerSayHelloMuti() throws TException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientSayHello(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientSayHello(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerSayHello() throws TException { + this.startAsyncHsHaServer(this.port); + this.syncFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerSayHelloMuti() throws TException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientSayHello(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientSayHello(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHello() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + this.nonBlockClientSayHello(this.port); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHelloMuti() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientSayHello(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientSayHello(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHello() throws TException, IOException { + this.startSyncHsHaServer(this.port); + this.nonBlockClientSayHello(this.port); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHelloMuti() throws TException, IOException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientSayHello(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientSayHello(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerSayHelloError() { + Exception error = null; + try { + this.startAsyncNonblockingServer(this.port); + this.syncClientSayHello(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("sayHello", 1); + } + + @Test + public void syncClientSyncNonblockingServerSayHelloError() { + Exception error = null; + try { + this.startSyncNonblockingServer(this.port); + this.syncClientSayHello(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("sayHello", 1); + } + + @Test + public void syncClientAsyncHsHaServerSayHelloError() { + Exception error = null; + try { + this.startAsyncHsHaServer(this.port); + this.syncClientSayHello(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("sayHello", 1); + } + + @Test + public void syncClientSyncHsHaServerSayHelloError() { + Exception error = null; + try { + this.startSyncHsHaServer(this.port); + this.syncClientSayHello(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("sayHello", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerSayHello() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + this.nonBlockClientSayHello(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerSayHelloMuti() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientSayHello(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientSayHello(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerSayHello() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + this.nonBlockClientSayHello(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerSayHelloMuti() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientSayHello(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientSayHello(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", threadCount); + } + + public void syncClientSayHello(int port) throws TException { + try (TTransport transport = new TSocket("localhost", port)) { + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.sayHello("US", "Bob")); + Assertions.assertThat(response).isEqualTo("Hello USs' Bob"); + } + } + + public void syncClientMultiSayHello(int port) throws TException { + try (TTransport transport = new TSocket("localhost", port)) { + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + String response = this.testing().runWithSpan("parent", () -> client.sayHello("US", "Bob")); + Assertions.assertThat(response).isEqualTo("Hello USs' Bob"); + } + } + + public void nonBlockClientSayHello(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(String s) { + Assertions.assertThat(s).isEqualTo("Hello USs' Bob"); + } + + @Override + public void onError(Exception e) { + throw new VerifyException("nonBlockClientSayHello test failed", e); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.sayHello("US", "Bob", callback)); + } + + public void syncFramedClientSayHello(int port) throws TException { + try (TSocket tSocket = new TSocket("localhost", port)) { + TFramedTransport framedTransport = new TFramedTransport(tSocket); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.sayHello("US", "Bob")); + Assertions.assertThat(response).isEqualTo("Hello USs' Bob"); + } + } + + public void syncFramedClientMultiSayHello(int port) throws TException { + try (TSocket tSocket = new TSocket("localhost", port)) { + TFramedTransport framedTransport = new TFramedTransport(tSocket); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + String response = this.testing().runWithSpan("parent", () -> client.sayHello("US", "Bob")); + Assertions.assertThat(response).isEqualTo("Hello USs' Bob"); + } + } + + public void syncNonblockingSaslClientSayHello(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.sayHello("US", "Bob")); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/TestSaslCallbackHandler.java b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/TestSaslCallbackHandler.java new file mode 100644 index 000000000000..6b6ae0c26436 --- /dev/null +++ b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/TestSaslCallbackHandler.java @@ -0,0 +1,47 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_14_0; + +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.NameCallback; +import javax.security.auth.callback.PasswordCallback; +import javax.security.auth.callback.UnsupportedCallbackException; +import javax.security.sasl.AuthorizeCallback; +import javax.security.sasl.RealmCallback; + +public class TestSaslCallbackHandler implements CallbackHandler { + public static final String PRINCIPAL = "thrift-test-principal"; + public static final String REALM = "thrift-test-realm"; + private final String password; + + public TestSaslCallbackHandler(String password) { + this.password = password; + } + + @Override + public void handle(Callback[] callbacks) throws UnsupportedCallbackException { + Callback[] var2 = callbacks; + int var3 = callbacks.length; + + for (int var4 = 0; var4 < var3; ++var4) { + Callback c = var2[var4]; + if (c instanceof NameCallback) { + ((NameCallback) c).setName("thrift-test-principal"); + } else if (c instanceof PasswordCallback) { + ((PasswordCallback) c).setPassword(this.password.toCharArray()); + } else if (c instanceof AuthorizeCallback) { + ((AuthorizeCallback) c).setAuthorized(true); + } else { + if (!(c instanceof RealmCallback)) { + throw new UnsupportedCallbackException(c); + } + + ((RealmCallback) c).setText("thrift-test-realm"); + } + } + } +} diff --git a/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/ThriftBaseTest.java b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/ThriftBaseTest.java new file mode 100644 index 000000000000..2992117f7e08 --- /dev/null +++ b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/ThriftBaseTest.java @@ -0,0 +1,872 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_14_0; + +import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo; +import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.satisfies; + +import com.google.common.base.VerifyException; +import io.opentelemetry.api.common.AttributeKey; +import io.opentelemetry.api.trace.SpanKind; +import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension; +import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; +import io.opentelemetry.instrumentation.thrift.v0_14_0.server.ThriftServiceAsyncImpl; +import io.opentelemetry.instrumentation.thrift.v0_14_0.server.ThriftServiceImpl; +import io.opentelemetry.instrumentation.thrift.v0_14_0.thrift.ThriftService; +import io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions; +import io.opentelemetry.sdk.testing.assertj.SpanDataAssert; +import io.opentelemetry.sdk.testing.assertj.TraceAssert; +import io.opentelemetry.sdk.trace.data.StatusData; +import io.opentelemetry.semconv.SemanticAttributes; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.nio.charset.Charset; +import java.util.HashMap; +import java.util.Map; +import java.util.Random; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.function.Consumer; +import java.util.logging.Logger; +import org.apache.thrift.TMultiplexedProcessor; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.server.THsHaServer; +import org.apache.thrift.server.TNonblockingServer; +import org.apache.thrift.server.TSaslNonblockingServer; +import org.apache.thrift.server.TServer; +import org.apache.thrift.server.TSimpleServer; +import org.apache.thrift.server.TThreadPoolServer; +import org.apache.thrift.server.TThreadedSelectorServer; +import org.apache.thrift.transport.TNonblockingServerSocket; +import org.apache.thrift.transport.TNonblockingServerTransport; +import org.apache.thrift.transport.TSaslServerTransport; +import org.apache.thrift.transport.TServerSocket; +import org.apache.thrift.transport.TServerTransport; +import org.apache.thrift.transport.TTransportException; +import org.apache.thrift.transport.layered.TFramedTransport; +import org.assertj.core.api.AbstractAssert; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.extension.RegisterExtension; + +public abstract class ThriftBaseTest { + private static final Logger logger = Logger.getLogger(ThriftBaseTest.class.getName()); + public TServer server; + public int port = 13100; + + private static final String ASYNC_CLIENT = + "io.opentelemetry.instrumentation.thrift.v0_14_0.thrift.ThriftService$AsyncClient"; + private static final String SYNC_CLIENT = + "io.opentelemetry.instrumentation.thrift.v0_14_0.thrift.ThriftService$Client"; + private static final String ASYNC_SERVER = + "io.opentelemetry.instrumentation.thrift.v0_14_0.server.ThriftServiceAsyncImpl"; + private static final String SYNC_SERVER = + "io.opentelemetry.instrumentation.thrift.v0_14_0.server.ThriftServiceImpl"; + private static final String PEER_NAME = "localhost"; + private static final String PEER_ADDR = "127.0.0.1"; + + private static final String TRANSPORT_EXCEPTION = + "org.apache.thrift.transport.TTransportException"; + private static final String VERIFY_EXCEPTION = "com.google.common.base.VerifyException"; + private static final String APP_EXCEPTION = "org.apache.thrift.TApplicationException"; + + @RegisterExtension + static InstrumentationExtension testing = AgentInstrumentationExtension.create(); + + protected InstrumentationExtension testing() { + return testing; + } + + @BeforeEach + public void before() { + ++this.port; + logger.info( + "before port=" + + this.port + + ", threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + } + + @AfterEach + public void after() { + this.stopServer(); + } + + public int getPort() { + Random random = new Random(); + int newPort = this.port + random.nextInt(2000); + while (portNotRelease(newPort)) { + newPort = this.port + random.nextInt(2000); + } + return newPort; + } + + public static boolean portNotRelease(int port) { + Process process = null; + String pid = null; + try { + process = Runtime.getRuntime().exec("lsof -ti:" + port); + BufferedReader reader = + new BufferedReader( + new InputStreamReader(process.getInputStream(), Charset.defaultCharset())); + pid = reader.readLine(); + } catch (IOException e) { + throw new VerifyException(e); + } + return pid != null && !pid.isEmpty(); + } + + public void startSyncSimpleServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TServerTransport serverTransport = new TServerSocket(port); + this.server = new TSimpleServer(new TServer.Args(serverTransport).processor(processor)); + new Thread( + () -> { + logger.info( + "Starting startSyncSimpleServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startAsyncSimpleServer(int port) throws TTransportException { + ThriftServiceAsyncImpl impl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor processor = + new ThriftService.AsyncProcessor(impl); + TServerTransport serverTransport = new TServerSocket(port); + this.server = new TSimpleServer(new TServer.Args(serverTransport).processor(processor)); + new Thread( + () -> { + logger.info( + "Starting startAsyncSimpleServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startMultiSimpleServer(int port) throws TTransportException { + ThriftServiceImpl syncImpl = new ThriftServiceImpl(); + ThriftService.Processor syncProcessor = + new ThriftService.Processor(syncImpl); + ThriftServiceAsyncImpl asyncImpl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor asyncProcessor = + new ThriftService.AsyncProcessor(asyncImpl); + TMultiplexedProcessor multiplexedProcessor = new TMultiplexedProcessor(); + multiplexedProcessor.registerProcessor("syncHelloWorld", syncProcessor); + multiplexedProcessor.registerProcessor("asyncHelloWorld", asyncProcessor); + TServerTransport serverTransport = new TServerSocket(port); + this.server = + new TSimpleServer(new TServer.Args(serverTransport).processor(multiplexedProcessor)); + new Thread( + () -> { + logger.info( + "Starting startMultiSimpleServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startMultiThreadedSelectorServer(int port) throws TTransportException { + ThriftServiceImpl syncImpl = new ThriftServiceImpl(); + ThriftService.Processor syncProcessor = + new ThriftService.Processor(syncImpl); + ThriftServiceAsyncImpl asyncImpl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor asyncProcessor = + new ThriftService.AsyncProcessor(asyncImpl); + TMultiplexedProcessor multiplexedProcessor = new TMultiplexedProcessor(); + multiplexedProcessor.registerProcessor("syncHelloWorld", syncProcessor); + multiplexedProcessor.registerProcessor("asyncHelloWorld", asyncProcessor); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TThreadedSelectorServer.Args serverArgs = + new TThreadedSelectorServer.Args(transport) + .selectorThreads(5) + .workerThreads(10) + .acceptQueueSizePerThread(20) + .processor(multiplexedProcessor); + this.server = new TThreadedSelectorServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startMultiThreadedSelectorServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startSyncThreadedSelectorServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TThreadedSelectorServer.Args serverArgs = + new TThreadedSelectorServer.Args(transport) + .selectorThreads(5) + .workerThreads(10) + .acceptQueueSizePerThread(20) + .processor(processor); + this.server = new TThreadedSelectorServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startAsyncServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startAsyncThreadedSelectorServer(int port) throws TTransportException { + ThriftServiceAsyncImpl impl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor processor = + new ThriftService.AsyncProcessor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TThreadedSelectorServer.Args serverArgs = + new TThreadedSelectorServer.Args(transport) + .selectorThreads(5) + .workerThreads(10) + .acceptQueueSizePerThread(20) + .processor(processor); + this.server = new TThreadedSelectorServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startNonBlockingServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startSyncNonblockingServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TNonblockingServer.Args serverArgs = + new TNonblockingServer.Args(transport).processor(processor); + this.server = new TNonblockingServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startNonBlockingServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startAsyncNonblockingServer(int port) throws TTransportException { + ThriftServiceAsyncImpl impl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor processor = + new ThriftService.AsyncProcessor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TNonblockingServer.Args serverArgs = + new TNonblockingServer.Args(transport).processor(processor); + this.server = new TNonblockingServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startNonBlockingServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startAsyncThreadPoolServer(int port) throws TTransportException { + ThriftServiceAsyncImpl impl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor processor = + new ThriftService.AsyncProcessor(impl); + TServerSocket transport = new TServerSocket(port); + TThreadPoolServer.Args serverArgs = + new TThreadPoolServer.Args(transport) + .minWorkerThreads(5) + .maxWorkerThreads(10) + .processor(processor); + TServer server = new TThreadPoolServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startNonBlockingServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + server.serve(); + }) + .start(); + } + + public void startSyncThreadPoolServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TServerSocket transport = new TServerSocket(port); + ExecutorService executor = Executors.newFixedThreadPool(5); + TThreadPoolServer.Args serverArgs = + new TThreadPoolServer.Args(transport).executorService(executor).processor(processor); + TServer server = new TThreadPoolServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startSyncThreadPoolServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + server.serve(); + }) + .start(); + } + + public void startSyncHsHaServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TBinaryProtocol.Factory protocolFactory = new TBinaryProtocol.Factory(); + TFramedTransport.Factory transportFactory = new TFramedTransport.Factory(); + THsHaServer.Args serverArgs = + new THsHaServer.Args(transport) + .processor(processor) + .protocolFactory(protocolFactory) + .transportFactory(transportFactory) + .minWorkerThreads(5) + .maxWorkerThreads(10); + this.server = new THsHaServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startSyncTHsHaServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startAsyncHsHaServer(int port) throws TTransportException { + ThriftServiceAsyncImpl impl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor processor = + new ThriftService.AsyncProcessor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TBinaryProtocol.Factory protocolFactory = new TBinaryProtocol.Factory(); + TFramedTransport.Factory transportFactory = new TFramedTransport.Factory(); + THsHaServer.Args serverArgs = + new THsHaServer.Args(transport) + .processor(processor) + .protocolFactory(protocolFactory) + .transportFactory(transportFactory) + .minWorkerThreads(5) + .maxWorkerThreads(10); + this.server = new THsHaServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startAsyncTHsHaServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startAsyncSaslNonblockingServer(int port) throws TTransportException, IOException { + ThriftServiceAsyncImpl impl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor processor = + new ThriftService.AsyncProcessor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + Map saslOptions = new HashMap<>(); + saslOptions.put("javax.security.sasl.qop", "auth"); + saslOptions.put("javax.security.sasl.server.authentication", "true"); + TSaslServerTransport.Factory saslTransportFactory = new TSaslServerTransport.Factory(); + saslTransportFactory.addServerDefinition( + "PLAIN", null, null, saslOptions, new TestSaslCallbackHandler("12345")); + TBinaryProtocol.Factory protocolFactory = new TBinaryProtocol.Factory(); + TSaslNonblockingServer.Args serverArgs = + new TSaslNonblockingServer.Args(transport) + .processor(processor) + .protocolFactory(protocolFactory) + .transportFactory(saslTransportFactory); + this.server = new TSaslNonblockingServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startAsyncSaslNonblockingServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startSyncSaslNonblockingServer(int port) throws TTransportException, IOException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + Map saslOptions = new HashMap(); + saslOptions.put("javax.security.sasl.qop", "auth"); + saslOptions.put("javax.security.sasl.server.authentication", "true"); + TSaslServerTransport.Factory saslTransportFactory = new TSaslServerTransport.Factory(); + saslTransportFactory.addServerDefinition( + "PLAIN", null, null, saslOptions, new TestSaslCallbackHandler("12345")); + TBinaryProtocol.Factory protocolFactory = new TBinaryProtocol.Factory(); + TSaslNonblockingServer.Args serverArgs = + new TSaslNonblockingServer.Args(transport) + .processor(processor) + .protocolFactory(protocolFactory) + .transportFactory(saslTransportFactory); + this.server = new TSaslNonblockingServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startAsyncSaslNonblockingServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void stopServer() { + if (this.server != null) { + this.server.stop(); + logger.info( + "Server stopped" + + ", threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + } + } + + public void waitAndAssertTracesClientSyncServerSync(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.unset(), + null, + null); + } + + public void waitAndAssertTracesClientSyncServerSync( + String clientMethod, String serverMethod, int count) { + this.baseWaitAndAssertTraces( + clientMethod, + serverMethod, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.unset(), + null, + null); + } + + public void waitAndAssertTracesClientSyncServerSyncWithError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> val.isIn("Internal error processing " + method), + APP_EXCEPTION, + SYNC_SERVER, + StatusData.unset(), + null, + null); + } + + public void waitAndAssertTracesClientSyncServerSyncWithError( + String clientMethod, String serverMethod, int count) { + this.baseWaitAndAssertTraces( + clientMethod, + serverMethod, + count, + SYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> val.isIn("Internal error processing " + clientMethod), + APP_EXCEPTION, + SYNC_SERVER, + StatusData.unset(), + null, + null); + } + + public void waitAndAssertTracesClientAsyncServerAsync(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + ASYNC_SERVER, + StatusData.unset(), + null, + null); + } + + public void waitAndAssertTracesClientAsyncServerAsyncError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + ASYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientAsyncServerAsyncWithError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> val.isIn("fail"), + APP_EXCEPTION, + ASYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientAsyncServerSync(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.unset(), + null, + null); + } + + public void waitAndAssertTracesClientAsyncServerSyncWithError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> val.isIn("Internal error processing " + method), + APP_EXCEPTION, + SYNC_SERVER, + StatusData.unset(), + null, + null); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) // 测试代码 + public void waitAndAssertTracesClientSyncServerAsync(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + ASYNC_SERVER, + StatusData.unset(), + null, + null); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) // 测试代码 + public void waitAndAssertTracesClientSyncServerAsyncError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + ASYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) // 测试代码 + public void waitAndAssertTracesClientSyncServerAsyncWithError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> val.isIn("fail"), + APP_EXCEPTION, + ASYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientSyncNoServer(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> val.isIn("Socket is closed by peer.", "java.net.SocketException: Connection reset"), + TRANSPORT_EXCEPTION, + null, + null, + null, + null); + } + + public void waitAndAssertTracesClientSyncNoServerOneway(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + null, + null, + null, + null); + } + + public void waitAndAssertTracesClientSyncNoServerNoSasl(String method, int count) { + this.baseWaitAndAssertTraces( + method, + null, + count, + SYNC_CLIENT, + StatusData.error(), + null, + null, + val -> val.isIn("SASL authentication not complete"), + TRANSPORT_EXCEPTION, + null, + null, + null, + null); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) // 测试代码 + private void baseWaitAndAssertTraces( + String clientMethod, + String serverMethod, + int count, + String clientClass, + StatusData clientStatus, + String peerName, + String peerAddr, + OpenTelemetryAssertions.StringAssertConsumer clientAssertion, + String clientErrorType, + String serverClass, + StatusData serverStatus, + OpenTelemetryAssertions.StringAssertConsumer serviceAssertion, + String serverErrorType) { + Consumer[] consumers = new Consumer[count]; + Consumer traceAssertConsumer; + if (serverClass == null) { + traceAssertConsumer = + trace -> + trace.hasSpansSatisfyingExactly( + span -> span.hasName("parent").hasKind(SpanKind.INTERNAL).hasNoParent(), + clientSpanDataAssertConsumer( + clientMethod, + clientClass, + clientStatus, + trace, + peerName, + peerAddr, + clientAssertion, + clientErrorType)); + } else { + traceAssertConsumer = + trace -> + trace.hasSpansSatisfyingExactly( + span -> span.hasName("parent").hasKind(SpanKind.INTERNAL).hasNoParent(), + clientSpanDataAssertConsumer( + clientMethod, + clientClass, + clientStatus, + trace, + peerName, + peerAddr, + clientAssertion, + clientErrorType), + serverSpanDataAssertConsumer( + serverMethod, + serverClass, + serverStatus, + trace, + serviceAssertion, + serverErrorType)); + } + + for (int i = 0; i < count; ++i) { + consumers[i] = traceAssertConsumer; + } + this.testing().waitAndAssertTraces(consumers); + } + + @SuppressWarnings({"ReturnValueIgnored"}) + private static Consumer clientSpanDataAssertConsumer( + String clientMethod, + String clientClass, + StatusData statusData, + TraceAssert trace, + String peerName, + String peerAddr, + OpenTelemetryAssertions.StringAssertConsumer errorMsgAssertion, + String errorType) { + Consumer consumer = + span -> + span.hasName(clientMethod) + .hasKind(SpanKind.CLIENT) + .hasParent(trace.getSpan(0)) + .hasStatus(statusData) + .hasAttributesSatisfying( + equalTo(AttributeKey.stringKey("net.sock.peer.name"), peerName), + equalTo(AttributeKey.stringKey("net.sock.peer.addr"), peerAddr), + equalTo(SemanticAttributes.RPC_SYSTEM, "thrift"), + equalTo(SemanticAttributes.RPC_SERVICE, clientClass), + equalTo(SemanticAttributes.RPC_METHOD, clientMethod)); + if (statusData == StatusData.error()) { + consumer = + consumer.andThen( + span -> + span.hasEventsSatisfyingExactly( + event -> + event + .hasName(SemanticAttributes.EXCEPTION_EVENT_NAME) + .hasAttributesSatisfyingExactly( + satisfies( + SemanticAttributes.EXCEPTION_MESSAGE, errorMsgAssertion), + satisfies( + AttributeKey.stringKey("exception.stacktrace"), + AbstractAssert::isNotNull), + equalTo(SemanticAttributes.EXCEPTION_TYPE, errorType)))); + } + return consumer; + } + + @SuppressWarnings({"ReturnValueIgnored"}) + private static Consumer serverSpanDataAssertConsumer( + String serverMethod, + String serverClass, + StatusData statusData, + TraceAssert trace, + OpenTelemetryAssertions.StringAssertConsumer errorMsgAssertion, + String errorType) { + Consumer consumer = + span -> + span.hasName(serverMethod) + .hasKind(SpanKind.SERVER) + .hasParent(trace.getSpan(1)) + .hasStatus(statusData) + .hasAttributesSatisfying( + equalTo(AttributeKey.stringKey("net.sock.peer.addr"), "127.0.0.1"), + equalTo(SemanticAttributes.RPC_SYSTEM, "thrift"), + equalTo(SemanticAttributes.RPC_SERVICE, serverClass), + equalTo(SemanticAttributes.RPC_METHOD, serverMethod)); + if (statusData == StatusData.error()) { + consumer = + consumer.andThen( + span -> + span.hasEventsSatisfyingExactly( + event -> + event + .hasName(SemanticAttributes.EXCEPTION_EVENT_NAME) + .hasAttributesSatisfyingExactly( + satisfies( + SemanticAttributes.EXCEPTION_MESSAGE, errorMsgAssertion), + satisfies( + AttributeKey.stringKey("exception.stacktrace"), + AbstractAssert::isNotNull), + equalTo(SemanticAttributes.EXCEPTION_TYPE, errorType)))); + } + return consumer; + } +} diff --git a/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/WithDelayTest.java b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/WithDelayTest.java new file mode 100644 index 000000000000..a244e2e64e28 --- /dev/null +++ b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/WithDelayTest.java @@ -0,0 +1,987 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_14_0; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_14_0.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.apache.thrift.transport.layered.TFramedTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class WithDelayTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerSayHello() throws TException { + this.startSyncSimpleServer(this.port); + this.syncClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", 1); + } + + @Test + public void syncClientSyncSimpleServerSayHelloMuti() throws TException { + this.startSyncSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithDelay(this.port, 2); + } + this.waitAndAssertTracesClientSyncServerSync("withDelay", 5); + } + + @Test + public void syncClientSyncSimpleServerSayHelloParallel() throws TException, InterruptedException { + this.startSyncSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithDelay(this.port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withDelay", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerSayHello() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientWithDelay(port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", 1); + } + + @Test + public void syncClientSyncThreadPoolServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithDelay(port, 2); + } + this.waitAndAssertTracesClientSyncServerSync("withDelay", 5); + } + + @Test + public void syncClientSyncThreadPoolServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithDelay(port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withDelay", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerSayHello() throws TException { + this.startMultiSimpleServer(this.port); + this.syncClientMultiWithDelay(this.port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", "syncHelloWorld:withDelay", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerSayHelloMuti() throws TException { + this.startMultiSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiWithDelay(this.port, 2); + } + this.waitAndAssertTracesClientSyncServerSync("withDelay", "syncHelloWorld:withDelay", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerSayHelloParallel() + throws TException, InterruptedException { + this.startMultiSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiWithDelay(this.port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "withDelay", "syncHelloWorld:withDelay", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerSayHelloError() { + Exception error = null; + try { + this.startSyncThreadedSelectorServer(this.port); + this.syncClientWithDelay(this.port, 2); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withDelay", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerSayHelloError() { + Exception error = null; + try { + this.startAsyncThreadedSelectorServer(this.port); + this.syncClientWithDelay(this.port, 2); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withDelay", 1); + } + + @Test + public void syncNonblockingSaslClientSyncSaslNonblockingServerSayHelloError() { + Exception error = null; + try { + this.startSyncSaslNonblockingServer(this.port); + this.syncNonblockingSaslClientWithDelay(this.port, 2); + } catch (IOException | TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerNoSasl("withDelay", 1); + } + + @Test + public void syncNonblockingSaslClientAsyncSaslNonblockingServerSayHelloError() { + Exception error = null; + try { + this.startAsyncSaslNonblockingServer(this.port); + this.syncNonblockingSaslClientWithDelay(this.port, 2); + } catch (IOException | TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerNoSasl("withDelay", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerSayHello() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + this.syncFramedClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientSyncServerAsync("withDelay", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerSayHelloMuti() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientSyncServerAsync("withDelay", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithDelay(this.port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("withDelay", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerSayHello() throws TException { + this.startMultiThreadedSelectorServer(this.port); + this.syncFramedClientMultiWithDelay(this.port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", "syncHelloWorld:withDelay", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerSayHelloMuti() throws TException { + this.startMultiThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientSyncServerSync("withDelay", "syncHelloWorld:withDelay", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + this.startMultiThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiWithDelay(this.port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "withDelay", "syncHelloWorld:withDelay", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerSayHello() throws TException { + this.startSyncThreadedSelectorServer(this.port); + this.syncFramedClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerSayHelloMuti() throws TException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientSyncServerSync("withDelay", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithDelay(this.port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withDelay", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerSayHello() throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + this.nonBlockClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerSayHelloMuti() + throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithDelay(this.port, 2); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerSayHello() throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + this.nonBlockClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerSayHelloMuti() + throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithDelay(this.port, 2); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHello() throws TException { + this.startSyncNonblockingServer(this.port); + this.syncFramedClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHelloMuti() throws TException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientSyncServerSync("withDelay", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithDelay(this.port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withDelay", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHello() throws TException { + this.startSyncHsHaServer(this.port); + this.syncFramedClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHelloMuti() throws TException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientSyncServerSync("withDelay", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithDelay(this.port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withDelay", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerSayHello() throws TException { + this.startAsyncNonblockingServer(this.port); + this.syncFramedClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientSyncServerAsync("withDelay", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerSayHelloMuti() throws TException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientSyncServerAsync("withDelay", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithDelay(this.port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("withDelay", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerSayHello() throws TException { + this.startAsyncHsHaServer(this.port); + this.syncFramedClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientSyncServerAsync("withDelay", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerSayHelloMuti() throws TException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientSyncServerAsync("withDelay", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithDelay(this.port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("withDelay", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHello() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + this.nonBlockClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHelloMuti() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithDelay(this.port, 1); + } + + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithDelay(this.port, 1); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHello() throws TException, IOException { + this.startSyncHsHaServer(this.port); + this.nonBlockClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHelloMuti() throws TException, IOException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithDelay(this.port, 2); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerSayHelloError() { + Exception error = null; + try { + this.startAsyncNonblockingServer(this.port); + this.syncClientWithDelay(this.port, 2); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withDelay", 1); + } + + @Test + public void syncClientSyncNonblockingServerSayHelloError() { + Exception error = null; + try { + this.startSyncNonblockingServer(this.port); + this.syncClientWithDelay(this.port, 2); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withDelay", 1); + } + + @Test + public void syncClientAsyncHsHaServerSayHelloError() { + Exception error = null; + try { + this.startAsyncHsHaServer(this.port); + this.syncClientWithDelay(this.port, 2); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withDelay", 1); + } + + @Test + public void syncClientSyncHsHaServerSayHelloError() { + Exception error = null; + try { + this.startSyncHsHaServer(this.port); + this.syncClientWithDelay(this.port, 2); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withDelay", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerSayHello() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + this.nonBlockClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerSayHelloMuti() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithDelay(this.port, 1); + } + + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithDelay(this.port, 1); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerSayHello() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + this.nonBlockClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerSayHelloMuti() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithDelay(this.port, 2); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", threadCount); + } + + public void syncClientWithDelay(int port, int delay) throws TException { + try (TTransport transport = new TSocket("localhost", port)) { + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.withDelay(delay)); + Assertions.assertThat(response).isEqualTo("delay " + delay); + } + } + + public void syncClientMultiWithDelay(int port, int delay) throws TException { + try (TTransport transport = new TSocket("localhost", port)) { + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + this.testing().runWithSpan("parent", () -> client.withDelay(delay)); + } + } + + public void nonBlockClientWithDelay(int port, int delay) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(String s) { + Assertions.assertThat(s).isEqualTo("delay " + delay); + } + + @Override + public void onError(Exception e) { + throw new VerifyException("nonBlockClientWithDelay test failed", e); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.withDelay(delay, callback)); + } + + public void syncFramedClientWithDelay(int port, int delay) throws TException { + TFramedTransport framedTransport = new TFramedTransport(new TSocket("localhost", port)); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.withDelay(delay)); + Assertions.assertThat(response).isEqualTo("delay " + delay); + } + + public void syncFramedClientMultiWithDelay(int port, int delay) throws TException { + TFramedTransport framedTransport = new TFramedTransport(new TSocket("localhost", port)); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + String response = this.testing().runWithSpan("parent", () -> client.withDelay(delay)); + Assertions.assertThat(response).isEqualTo("delay " + delay); + } + + public void syncNonblockingSaslClientWithDelay(int port, int delay) + throws TException, IOException { + + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withDelay(delay)); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/WithErrorTest.java b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/WithErrorTest.java new file mode 100644 index 000000000000..d2a71588a10a --- /dev/null +++ b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/WithErrorTest.java @@ -0,0 +1,1011 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_14_0; + +import io.opentelemetry.instrumentation.thrift.v0_14_0.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.apache.thrift.transport.layered.TFramedTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class WithErrorTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerWithError() throws TException { + this.startSyncSimpleServer(this.port); + this.syncClientWithError(this.port); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 1); + } + + @Test + public void syncClientSyncSimpleServerWithErrorMuti() throws TException { + this.startSyncSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithError(this.port); + } + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 5); + } + + @Test + public void syncClientSyncSimpleServerWithErrorParallel() + throws TException, InterruptedException { + this.startSyncSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerWithError() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientWithError(port); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 1); + } + + @Test + public void syncClientSyncThreadPoolServerWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithError(port); + } + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 5); + } + + @Test + public void syncClientSyncThreadPoolServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerWithError() throws TException { + this.startMultiSimpleServer(this.port); + this.syncClientMultiWithError(this.port); + this.waitAndAssertTracesClientSyncServerSyncWithError( + "withError", "syncHelloWorld:withError", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerWithErrorMuti() throws TException { + this.startMultiSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiWithError(this.port); + } + this.waitAndAssertTracesClientSyncServerSyncWithError( + "withError", "syncHelloWorld:withError", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerWithErrorParallel() + throws TException, InterruptedException { + this.startMultiSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError( + "withError", "syncHelloWorld:withError", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerWithErrorError() { + Exception error = null; + try { + this.startSyncThreadedSelectorServer(this.port); + this.syncClientWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServer("withError", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerWithErrorError() { + Exception error = null; + try { + this.startAsyncThreadedSelectorServer(this.port); + this.syncClientWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServer("withError", 1); + } + + @Test + public void syncNonblockingSaslClientSyncSaslNonblockingServerWithErrorError() { + Exception error = null; + try { + this.startSyncSaslNonblockingServer(this.port); + this.syncNonblockingSaslClientWithError(this.port); + } catch (IOException | TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerNoSasl("withError", 1); + } + + @Test + public void syncNonblockingSaslClientAsyncSaslNonblockingServerWithErrorError() { + Exception error = null; + try { + this.startAsyncSaslNonblockingServer(this.port); + this.syncNonblockingSaslClientWithError(this.port); + } catch (IOException | TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerNoSasl("withError", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithError() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + this.syncFramedClientWithError(this.port); + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithErrorMuti() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithError() throws TException { + this.startMultiThreadedSelectorServer(this.port); + this.syncFramedClientMultiWithError(this.port); + this.waitAndAssertTracesClientSyncServerSyncWithError( + "withError", "syncHelloWorld:withError", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithErrorMuti() throws TException { + this.startMultiThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerSyncWithError( + "withError", "syncHelloWorld:withError", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithErrorParallel() + throws TException, InterruptedException { + this.startMultiThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError( + "withError", "syncHelloWorld:withError", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithError() throws TException { + this.startSyncThreadedSelectorServer(this.port); + this.syncFramedClientWithError(this.port); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithErrorMuti() throws TException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithErrorParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithError() throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + this.nonBlockClientWithError(this.port); + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithErrorMuti() + throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithError() throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + this.nonBlockClientWithError(this.port); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithErrorMuti() + throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithErrorParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithError() throws TException { + this.startSyncNonblockingServer(this.port); + this.syncFramedClientWithError(this.port); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithErrorMuti() throws TException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithErrorParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerWithError() throws TException { + this.startSyncHsHaServer(this.port); + this.syncFramedClientWithError(this.port); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerWithErrorMuti() throws TException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerWithErrorParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithError() throws TException { + this.startAsyncNonblockingServer(this.port); + this.syncFramedClientWithError(this.port); + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithErrorMuti() throws TException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithError() throws TException { + this.startAsyncHsHaServer(this.port); + this.syncFramedClientWithError(this.port); + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithErrorMuti() throws TException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithError() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + this.nonBlockClientWithError(this.port); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithErrorMuti() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithErrorParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerWithError() throws TException, IOException { + this.startSyncHsHaServer(this.port); + this.nonBlockClientWithError(this.port); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerWithErrorMuti() throws TException, IOException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerWithErrorParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerWithErrorError() { + Exception error = null; + try { + this.startAsyncNonblockingServer(this.port); + this.syncClientWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServer("withError", 1); + } + + @Test + public void syncClientSyncNonblockingServerWithErrorError() { + Exception error = null; + try { + this.startSyncNonblockingServer(this.port); + this.syncClientWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServer("withError", 1); + } + + @Test + public void syncClientAsyncHsHaServerWithErrorError() { + Exception error = null; + try { + this.startAsyncHsHaServer(this.port); + this.syncClientWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServer("withError", 1); + } + + @Test + public void syncClientSyncHsHaServerWithErrorError() { + Exception error = null; + try { + this.startSyncHsHaServer(this.port); + this.syncClientWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServer("withError", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithError() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + this.nonBlockClientWithError(this.port); + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithErrorMuti() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithError() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + this.nonBlockClientWithError(this.port); + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithErrorMuti() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", threadCount); + } + + public void syncClientWithError(int port) throws TException { + try (TTransport transport = new TSocket("localhost", port)) { + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } + } + + public void syncClientMultiWithError(int port) throws TException { + try (TTransport transport = new TSocket("localhost", port)) { + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } + } + + public void nonBlockClientWithError(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(String s) { + Assertions.assertThat(s).isEqualTo("Hello USs' Bob"); + } + + @Override + public void onError(Exception e) {} + }; + this.testing().runWithSpan("parent", () -> asyClient.withError(callback)); + } + + public void syncFramedClientWithError(int port) throws TException { + TFramedTransport framedTransport = new TFramedTransport(new TSocket("localhost", port)); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } + + public void syncFramedClientMultiWithError(int port) throws TException { + TFramedTransport framedTransport = new TFramedTransport(new TSocket("localhost", port)); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } + + public void syncNonblockingSaslClientWithError(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/WithStructTest.java b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/WithStructTest.java new file mode 100644 index 000000000000..3d25599184f4 --- /dev/null +++ b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/WithStructTest.java @@ -0,0 +1,1005 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_14_0; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_14_0.thrift.Account; +import io.opentelemetry.instrumentation.thrift.v0_14_0.thrift.ThriftService; +import io.opentelemetry.instrumentation.thrift.v0_14_0.thrift.User; +import io.opentelemetry.instrumentation.thrift.v0_14_0.thrift.UserAccount; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.apache.thrift.transport.layered.TFramedTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class WithStructTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerWithStruct() throws TException { + this.startSyncSimpleServer(this.port); + this.syncClientWithStruct(this.port); + this.waitAndAssertTracesClientSyncServerSync("data", 1); + } + + @Test + public void syncClientSyncSimpleServerWithStructMuti() throws TException { + this.startSyncSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithStruct(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("data", 5); + } + + @Test + public void syncClientSyncSimpleServerWithStructParallel() + throws TException, InterruptedException { + this.startSyncSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithStruct(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerWithStruct() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientWithStruct(port); + this.waitAndAssertTracesClientSyncServerSync("data", 1); + } + + @Test + public void syncClientSyncThreadPoolServerWithStructMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithStruct(port); + } + this.waitAndAssertTracesClientSyncServerSync("data", 5); + } + + @Test + public void syncClientSyncThreadPoolServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithStruct(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerWithStruct() throws TException { + this.startMultiSimpleServer(this.port); + this.syncClientMultiWithStruct(this.port); + this.waitAndAssertTracesClientSyncServerSync("data", "syncHelloWorld:data", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerWithStructMuti() throws TException { + this.startMultiSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiWithStruct(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("data", "syncHelloWorld:data", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerWithStructParallel() + throws TException, InterruptedException { + this.startMultiSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiWithStruct(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", "syncHelloWorld:data", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerWithStructError() { + Exception error = null; + try { + this.startSyncThreadedSelectorServer(this.port); + this.syncClientWithStruct(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("data", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerWithStructError() { + Exception error = null; + try { + this.startAsyncThreadedSelectorServer(this.port); + this.syncClientWithStruct(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("data", 1); + } + + @Test + public void syncNonblockingSaslClientSyncSaslNonblockingServerWithStructError() { + Exception error = null; + try { + this.startSyncSaslNonblockingServer(this.port); + this.syncNonblockingSaslClientWithStruct(this.port); + } catch (IOException | TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServerNoSasl("data", 1); + } + + @Test + public void syncNonblockingSaslClientAsyncSaslNonblockingServerWithStructError() { + Exception error = null; + try { + this.startAsyncSaslNonblockingServer(this.port); + this.syncNonblockingSaslClientWithStruct(this.port); + } catch (IOException | TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServerNoSasl("data", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithStruct() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + this.syncFramedClientWithStruct(this.port); + this.waitAndAssertTracesClientSyncServerAsync("data", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithStructMuti() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("data", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithStructParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithStruct(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("data", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithStruct() throws TException { + this.startMultiThreadedSelectorServer(this.port); + this.syncFramedClientMultiWithStruct(this.port); + this.waitAndAssertTracesClientSyncServerSync("data", "syncHelloWorld:data", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithStructMuti() throws TException { + this.startMultiThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiWithStruct(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("data", "syncHelloWorld:data", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithStructParallel() + throws TException, InterruptedException { + this.startMultiThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiWithStruct(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", "syncHelloWorld:data", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithStruct() throws TException { + this.startSyncThreadedSelectorServer(this.port); + this.syncFramedClientWithStruct(this.port); + this.waitAndAssertTracesClientSyncServerSync("data", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithStructMuti() throws TException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("data", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithStructParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithStruct(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithStruct() throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + this.nonBlockClientWithStruct(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("data", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithStructMuti() + throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("data", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithStructParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithStruct(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("data", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithStruct() throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + this.nonBlockClientWithStruct(this.port); + this.waitAndAssertTracesClientAsyncServerSync("data", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithStructMuti() + throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("data", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithStructParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithStruct(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("data", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithStruct() throws TException { + this.startSyncNonblockingServer(this.port); + this.syncFramedClientWithStruct(this.port); + this.waitAndAssertTracesClientSyncServerSync("data", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithStructMuti() throws TException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("data", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithStructParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithStruct(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerWithStruct() throws TException { + this.startSyncHsHaServer(this.port); + this.syncFramedClientWithStruct(this.port); + this.waitAndAssertTracesClientSyncServerSync("data", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerWithStructMuti() throws TException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("data", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerWithStructParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithStruct(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithStruct() throws TException { + this.startAsyncNonblockingServer(this.port); + this.syncFramedClientWithStruct(this.port); + this.waitAndAssertTracesClientSyncServerAsync("data", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithStructMuti() throws TException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("data", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithStructParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithStruct(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("data", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithStruct() throws TException { + this.startAsyncHsHaServer(this.port); + this.syncFramedClientWithStruct(this.port); + this.waitAndAssertTracesClientSyncServerAsync("data", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithStructMuti() throws TException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("data", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithStructParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithStruct(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("data", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithStruct() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + this.nonBlockClientWithStruct(this.port); + this.waitAndAssertTracesClientAsyncServerSync("data", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithStructMuti() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("data", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithStructParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithStruct(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("data", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerWithStruct() throws TException, IOException { + this.startSyncHsHaServer(this.port); + this.nonBlockClientWithStruct(this.port); + this.waitAndAssertTracesClientAsyncServerSync("data", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerWithStructMuti() throws TException, IOException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("data", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerWithStructParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithStruct(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("data", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerWithStructError() { + Exception error = null; + try { + this.startAsyncNonblockingServer(this.port); + this.syncClientWithStruct(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("data", 1); + } + + @Test + public void syncClientSyncNonblockingServerWithStructError() { + Exception error = null; + try { + this.startSyncNonblockingServer(this.port); + this.syncClientWithStruct(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("data", 1); + } + + @Test + public void syncClientAsyncHsHaServerWithStructError() { + Exception error = null; + try { + this.startAsyncHsHaServer(this.port); + this.syncClientWithStruct(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("data", 1); + } + + @Test + public void syncClientSyncHsHaServerWithStructError() { + Exception error = null; + try { + this.startSyncHsHaServer(this.port); + this.syncClientWithStruct(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("data", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithStruct() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + this.nonBlockClientWithStruct(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("data", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithStructMuti() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("data", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithStructParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithStruct(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("data", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithStruct() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + this.nonBlockClientWithStruct(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("data", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithStructMuti() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("data", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithStructParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithStruct(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("data", threadCount); + } + + public void syncClientWithStruct(int port) throws TException { + try (TTransport transport = new TSocket("localhost", port)) { + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + UserAccount response = this.testing().runWithSpan("parent", () -> client.data(user, account)); + Assertions.assertThat(response.user).isEqualTo(user); + Assertions.assertThat(response.account).isEqualTo(account); + } + } + + public void syncClientMultiWithStruct(int port) throws TException { + try (TTransport transport = new TSocket("localhost", port)) { + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + UserAccount response = this.testing().runWithSpan("parent", () -> client.data(user, account)); + Assertions.assertThat(response.user).isEqualTo(user); + Assertions.assertThat(response.account).isEqualTo(account); + } + } + + public void nonBlockClientWithStruct(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(UserAccount response) { + Assertions.assertThat(response.user).isEqualTo(user); + Assertions.assertThat(response.account).isEqualTo(account); + } + + @Override + public void onError(Exception e) { + throw new VerifyException("asyncClientWithStruct test failed", e); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.data(user, account, callback)); + } + + public void syncFramedClientWithStruct(int port) throws TException { + TFramedTransport framedTransport = new TFramedTransport(new TSocket("localhost", port)); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + UserAccount response = this.testing().runWithSpan("parent", () -> client.data(user, account)); + Assertions.assertThat(response.user).isEqualTo(user); + Assertions.assertThat(response.account).isEqualTo(account); + } + + public void syncFramedClientMultiWithStruct(int port) throws TException { + TFramedTransport framedTransport = new TFramedTransport(new TSocket("localhost", port)); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + UserAccount response = this.testing().runWithSpan("parent", () -> client.data(user, account)); + Assertions.assertThat(response.user).isEqualTo(user); + Assertions.assertThat(response.account).isEqualTo(account); + } + + public void syncNonblockingSaslClientWithStruct(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + UserAccount response = this.testing().runWithSpan("parent", () -> client.data(user, account)); + Assertions.assertThat(response.user).isEqualTo(user); + Assertions.assertThat(response.account).isEqualTo(account); + } +} diff --git a/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/WithoutArgsTest.java b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/WithoutArgsTest.java new file mode 100644 index 000000000000..9848b3ef7ee2 --- /dev/null +++ b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/WithoutArgsTest.java @@ -0,0 +1,991 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_14_0; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_14_0.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.apache.thrift.transport.layered.TFramedTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class WithoutArgsTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerWithoutArgs() throws TException { + this.startSyncSimpleServer(this.port); + this.syncClientWithoutArgs(this.port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 1); + } + + @Test + public void syncClientSyncSimpleServerWithoutArgsMuti() throws TException { + this.startSyncSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithoutArgs(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 5); + } + + @Test + public void syncClientSyncSimpleServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startSyncSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithoutArgs(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerWithoutArgs() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientWithoutArgs(port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 1); + } + + @Test + public void syncClientSyncThreadPoolServerWithoutArgsMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithoutArgs(port); + } + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 5); + } + + @Test + public void syncClientSyncThreadPoolServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithoutArgs(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerWithoutArgs() throws TException { + this.startMultiSimpleServer(this.port); + this.syncClientMultiWithoutArgs(this.port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", "syncHelloWorld:withoutArgs", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerWithoutArgsMuti() throws TException { + this.startMultiSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiWithoutArgs(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", "syncHelloWorld:withoutArgs", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startMultiSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiWithoutArgs(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "withoutArgs", "syncHelloWorld:withoutArgs", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerWithoutArgsError() { + Exception error = null; + try { + this.startSyncThreadedSelectorServer(this.port); + this.syncClientWithoutArgs(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withoutArgs", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerWithoutArgsError() { + Exception error = null; + try { + this.startAsyncThreadedSelectorServer(this.port); + this.syncClientWithoutArgs(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withoutArgs", 1); + } + + @Test + public void syncNonblockingSaslClientSyncSaslNonblockingServerWithoutArgsError() { + Exception error = null; + try { + this.startSyncSaslNonblockingServer(this.port); + this.syncNonblockingSaslClientWithoutArgs(this.port); + } catch (IOException | TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerNoSasl("withoutArgs", 1); + } + + @Test + public void syncNonblockingSaslClientAsyncSaslNonblockingServerWithoutArgsError() { + Exception error = null; + try { + this.startAsyncSaslNonblockingServer(this.port); + this.syncNonblockingSaslClientWithoutArgs(this.port); + } catch (IOException | TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerNoSasl("withoutArgs", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithoutArgs() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + this.syncFramedClientWithoutArgs(this.port); + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithoutArgsMuti() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithoutArgs(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithoutArgs() throws TException { + this.startMultiThreadedSelectorServer(this.port); + this.syncFramedClientMultiWithoutArgs(this.port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", "syncHelloWorld:withoutArgs", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithoutArgsMuti() throws TException { + this.startMultiThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", "syncHelloWorld:withoutArgs", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startMultiThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiWithoutArgs(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "withoutArgs", "syncHelloWorld:withoutArgs", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithoutArgs() throws TException { + this.startSyncThreadedSelectorServer(this.port); + this.syncFramedClientWithoutArgs(this.port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithoutArgsMuti() throws TException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithoutArgs(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithoutArgs() + throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + this.nonBlockClientWithoutArgs(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithoutArgsMuti() + throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithoutArgs(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithoutArgs() throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + this.nonBlockClientWithoutArgs(this.port); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithoutArgsMuti() + throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithoutArgs(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithoutArgs() throws TException { + this.startSyncNonblockingServer(this.port); + this.syncFramedClientWithoutArgs(this.port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithoutArgsMuti() throws TException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithoutArgs(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerWithoutArgs() throws TException { + this.startSyncHsHaServer(this.port); + this.syncFramedClientWithoutArgs(this.port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerWithoutArgsMuti() throws TException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithoutArgs(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithoutArgs() throws TException { + this.startAsyncNonblockingServer(this.port); + this.syncFramedClientWithoutArgs(this.port); + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithoutArgsMuti() throws TException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithoutArgs(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithoutArgs() throws TException { + this.startAsyncHsHaServer(this.port); + this.syncFramedClientWithoutArgs(this.port); + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithoutArgsMuti() throws TException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithoutArgs(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithoutArgs() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + this.nonBlockClientWithoutArgs(this.port); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithoutArgsMuti() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithoutArgs(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerWithoutArgs() throws TException, IOException { + this.startSyncHsHaServer(this.port); + this.nonBlockClientWithoutArgs(this.port); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerWithoutArgsMuti() throws TException, IOException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithoutArgs(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerWithoutArgsError() { + Exception error = null; + try { + this.startAsyncNonblockingServer(this.port); + this.syncClientWithoutArgs(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withoutArgs", 1); + } + + @Test + public void syncClientSyncNonblockingServerWithoutArgsError() { + Exception error = null; + try { + this.startSyncNonblockingServer(this.port); + this.syncClientWithoutArgs(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withoutArgs", 1); + } + + @Test + public void syncClientAsyncHsHaServerWithoutArgsError() { + Exception error = null; + try { + this.startAsyncHsHaServer(this.port); + this.syncClientWithoutArgs(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withoutArgs", 1); + } + + @Test + public void syncClientSyncHsHaServerWithoutArgsError() { + Exception error = null; + try { + this.startSyncHsHaServer(this.port); + this.syncClientWithoutArgs(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withoutArgs", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithoutArgs() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + this.nonBlockClientWithoutArgs(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithoutArgsMuti() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithoutArgs(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithoutArgs() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + this.nonBlockClientWithoutArgs(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithoutArgsMuti() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithoutArgs(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", threadCount); + } + + public void syncClientWithoutArgs(int port) throws TException { + try (TTransport transport = new TSocket("localhost", port)) { + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.withoutArgs()); + Assertions.assertThat(response).isEqualTo("no args"); + } + } + + public void syncClientMultiWithoutArgs(int port) throws TException { + try (TTransport transport = new TSocket("localhost", port)) { + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + String response = this.testing().runWithSpan("parent", () -> client.withoutArgs()); + Assertions.assertThat(response).isEqualTo("no args"); + } + } + + public void nonBlockClientWithoutArgs(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(String s) { + Assertions.assertThat(s).isEqualTo("no args"); + } + + @Override + public void onError(Exception e) { + throw new VerifyException("asyncClientWithoutArgs test failed", e); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.withoutArgs(callback)); + } + + public void syncFramedClientWithoutArgs(int port) throws TException { + TFramedTransport framedTransport = new TFramedTransport(new TSocket("localhost", port)); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.withoutArgs()); + Assertions.assertThat(response).isEqualTo("no args"); + } + + public void syncFramedClientMultiWithoutArgs(int port) throws TException { + TFramedTransport framedTransport = new TFramedTransport(new TSocket("localhost", port)); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + String response = this.testing().runWithSpan("parent", () -> client.withoutArgs()); + Assertions.assertThat(response).isEqualTo("no args"); + } + + public void syncNonblockingSaslClientWithoutArgs(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withoutArgs()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/server/ThriftServiceAsyncImpl.java b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/server/ThriftServiceAsyncImpl.java new file mode 100644 index 000000000000..96106d7c6b22 --- /dev/null +++ b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/server/ThriftServiceAsyncImpl.java @@ -0,0 +1,72 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_14_0.server; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_14_0.thrift.Account; +import io.opentelemetry.instrumentation.thrift.v0_14_0.thrift.ThriftService; +import io.opentelemetry.instrumentation.thrift.v0_14_0.thrift.User; +import io.opentelemetry.instrumentation.thrift.v0_14_0.thrift.UserAccount; +import java.util.concurrent.TimeUnit; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; + +public class ThriftServiceAsyncImpl implements ThriftService.AsyncIface { + public ThriftServiceAsyncImpl() {} + + @Override + public void sayHello(String zone, String name, AsyncMethodCallback resultHandler) { + resultHandler.onComplete("Hello " + zone + "s' " + name); + } + + @Override + public void withDelay(int delay, AsyncMethodCallback resultHandler) { + try { + TimeUnit.SECONDS.sleep(delay); + } catch (InterruptedException var4) { + InterruptedException e = var4; + throw new VerifyException(e); + } + + resultHandler.onComplete("delay " + delay); + } + + @Override + public void withoutArgs(AsyncMethodCallback resultHandler) { + resultHandler.onComplete("no args"); + } + + @Override + public void withError(AsyncMethodCallback resultHandler) { + throw new VerifyException("fail"); + } + + @Override + public void withCollisioin(String input, AsyncMethodCallback resultHandler) { + resultHandler.onComplete(input); + } + + @Override + public void noReturn(int delay, AsyncMethodCallback resultHandler) throws TException { + resultHandler.onComplete(null); + } + + @Override + public void oneWayHasArgs(int delay, AsyncMethodCallback resultHandler) throws TException {} + + @Override + public void oneWay(AsyncMethodCallback resultHandler) {} + + @Override + public void oneWayWithError(AsyncMethodCallback resultHandler) { + throw new VerifyException("fail"); + } + + @Override + public void data(User user, Account account, AsyncMethodCallback resultHandler) { + resultHandler.onComplete(new UserAccount(user, account)); + } +} diff --git a/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/server/ThriftServiceImpl.java b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/server/ThriftServiceImpl.java new file mode 100644 index 000000000000..f94cdf7b5f8b --- /dev/null +++ b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/server/ThriftServiceImpl.java @@ -0,0 +1,70 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_14_0.server; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_14_0.thrift.Account; +import io.opentelemetry.instrumentation.thrift.v0_14_0.thrift.ThriftService; +import io.opentelemetry.instrumentation.thrift.v0_14_0.thrift.User; +import io.opentelemetry.instrumentation.thrift.v0_14_0.thrift.UserAccount; +import java.util.concurrent.TimeUnit; +import org.apache.thrift.TException; + +public class ThriftServiceImpl implements ThriftService.Iface { + + public ThriftServiceImpl() {} + + @Override + public String sayHello(String zone, String name) { + return "Hello " + zone + "s' " + name; + } + + @Override + public String withDelay(int delay) { + try { + TimeUnit.SECONDS.sleep((long) delay); + } catch (InterruptedException var3) { + InterruptedException e = var3; + throw new VerifyException(e); + } + + return "delay " + delay; + } + + @Override + public String withoutArgs() { + return "no args"; + } + + @Override + public String withError() { + throw new VerifyException("fail"); + } + + @Override + public String withCollisioin(String input) { + return input; + } + + @Override + public void noReturn(int delay) throws TException {} + + @Override + public void oneWayHasArgs(int delay) throws TException {} + + @Override + public void oneWay() {} + + @Override + public void oneWayWithError() { + throw new VerifyException("fail"); + } + + @Override + public UserAccount data(User user, Account account) { + return new UserAccount(user, account); + } +} diff --git a/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/thrift/Account.java b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/thrift/Account.java new file mode 100644 index 000000000000..ad49f78eeb06 --- /dev/null +++ b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/thrift/Account.java @@ -0,0 +1,494 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_14_0.thrift; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused", "all"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.14.0)", + date = "2025-02-27") +public class Account + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("Account"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField CARD_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "cardId", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new AccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new AccountTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable String zone; // required + public @org.apache.thrift.annotation.Nullable String cardId; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + CARD_ID((short) 2, "cardId"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // CARD_ID + return CARD_ID; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.CARD_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "cardId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Account.class, metaDataMap); + } + + public Account() {} + + public Account(String zone, String cardId) { + this(); + this.zone = zone; + this.cardId = cardId; + } + + /** Performs a deep copy on other. */ + public Account(Account other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetCardId()) { + this.cardId = other.cardId; + } + } + + public Account deepCopy() { + return new Account(this); + } + + @Override + public void clear() { + this.zone = null; + this.cardId = null; + } + + @org.apache.thrift.annotation.Nullable + public String getZone() { + return this.zone; + } + + public Account setZone(@org.apache.thrift.annotation.Nullable String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + @org.apache.thrift.annotation.Nullable + public String getCardId() { + return this.cardId; + } + + public Account setCardId(@org.apache.thrift.annotation.Nullable String cardId) { + this.cardId = cardId; + return this; + } + + public void unsetCardId() { + this.cardId = null; + } + + /** Returns true if field cardId is set (has been assigned a value) and false otherwise */ + public boolean isSetCardId() { + return this.cardId != null; + } + + public void setCardIdIsSet(boolean value) { + if (!value) { + this.cardId = null; + } + } + + public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((String) value); + } + break; + + case CARD_ID: + if (value == null) { + unsetCardId(); + } else { + setCardId((String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case CARD_ID: + return getCardId(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case CARD_ID: + return isSetCardId(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that instanceof Account) return this.equals((Account) that); + return false; + } + + public boolean equals(Account that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_cardId = true && this.isSetCardId(); + boolean that_present_cardId = true && that.isSetCardId(); + if (this_present_cardId || that_present_cardId) { + if (!(this_present_cardId && that_present_cardId)) return false; + if (!this.cardId.equals(that.cardId)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetCardId()) ? 131071 : 524287); + if (isSetCardId()) hashCode = hashCode * 8191 + cardId.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(Account other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.compare(isSetZone(), other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.compare(isSetCardId(), other.isSetCardId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCardId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cardId, other.cardId); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("Account("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("cardId:"); + if (this.cardId == null) { + sb.append("null"); + } else { + sb.append(this.cardId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (zone == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'zone' was not present! Struct: " + toString()); + } + if (cardId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'cardId' was not present! Struct: " + toString()); + } + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class AccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public AccountStandardScheme getScheme() { + return new AccountStandardScheme(); + } + } + + private static class AccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // CARD_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, Account struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.cardId != null) { + oprot.writeFieldBegin(CARD_ID_FIELD_DESC); + oprot.writeString(struct.cardId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class AccountTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public AccountTupleScheme getScheme() { + return new AccountTupleScheme(); + } + } + + private static class AccountTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.zone); + oprot.writeString(struct.cardId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/thrift/ThriftService.java b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/thrift/ThriftService.java new file mode 100644 index 000000000000..3ca9e1f1758d --- /dev/null +++ b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/thrift/ThriftService.java @@ -0,0 +1,8066 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_14_0.thrift; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused", "all"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.14.0)", + date = "2025-02-27") +public class ThriftService { + + public interface Iface { + + public String sayHello(String zone, String name) throws org.apache.thrift.TException; + + public String withDelay(int delay) throws org.apache.thrift.TException; + + public String withoutArgs() throws org.apache.thrift.TException; + + public String withError() throws org.apache.thrift.TException; + + public String withCollisioin(String input) throws org.apache.thrift.TException; + + public void noReturn(int delay) throws org.apache.thrift.TException; + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException; + + public void oneWay() throws org.apache.thrift.TException; + + public void oneWayWithError() throws org.apache.thrift.TException; + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException; + } + + public interface AsyncIface { + + public void sayHello( + String zone, String name, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withoutArgs(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withCollisioin( + String input, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + } + + public static class Client extends org.apache.thrift.TServiceClient implements Iface { + public static class Factory implements org.apache.thrift.TServiceClientFactory { + public Factory() {} + + public Client getClient(org.apache.thrift.protocol.TProtocol prot) { + return new Client(prot); + } + + public Client getClient( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + return new Client(iprot, oprot); + } + } + + public Client(org.apache.thrift.protocol.TProtocol prot) { + super(prot, prot); + } + + public Client( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + super(iprot, oprot); + } + + public String sayHello(String zone, String name) throws org.apache.thrift.TException { + send_sayHello(zone, name); + return recv_sayHello(); + } + + public void send_sayHello(String zone, String name) throws org.apache.thrift.TException { + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + sendBase("sayHello", args); + } + + public String recv_sayHello() throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + receiveBase(result, "sayHello"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "sayHello failed: unknown result"); + } + + public String withDelay(int delay) throws org.apache.thrift.TException { + send_withDelay(delay); + return recv_withDelay(); + } + + public void send_withDelay(int delay) throws org.apache.thrift.TException { + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + sendBase("withDelay", args); + } + + public String recv_withDelay() throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + receiveBase(result, "withDelay"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withDelay failed: unknown result"); + } + + public String withoutArgs() throws org.apache.thrift.TException { + send_withoutArgs(); + return recv_withoutArgs(); + } + + public void send_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_args args = new withoutArgs_args(); + sendBase("withoutArgs", args); + } + + public String recv_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + receiveBase(result, "withoutArgs"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withoutArgs failed: unknown result"); + } + + public String withError() throws org.apache.thrift.TException { + send_withError(); + return recv_withError(); + } + + public void send_withError() throws org.apache.thrift.TException { + withError_args args = new withError_args(); + sendBase("withError", args); + } + + public String recv_withError() throws org.apache.thrift.TException { + withError_result result = new withError_result(); + receiveBase(result, "withError"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withError failed: unknown result"); + } + + public String withCollisioin(String input) throws org.apache.thrift.TException { + send_withCollisioin(input); + return recv_withCollisioin(); + } + + public void send_withCollisioin(String input) throws org.apache.thrift.TException { + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + sendBase("withCollisioin", args); + } + + public String recv_withCollisioin() throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + receiveBase(result, "withCollisioin"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withCollisioin failed: unknown result"); + } + + public void noReturn(int delay) throws org.apache.thrift.TException { + send_noReturn(delay); + recv_noReturn(); + } + + public void send_noReturn(int delay) throws org.apache.thrift.TException { + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + sendBase("noReturn", args); + } + + public void recv_noReturn() throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + receiveBase(result, "noReturn"); + return; + } + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException { + send_oneWayHasArgs(delay); + } + + public void send_oneWayHasArgs(int delay) throws org.apache.thrift.TException { + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + sendBaseOneway("oneWayHasArgs", args); + } + + public void oneWay() throws org.apache.thrift.TException { + send_oneWay(); + } + + public void send_oneWay() throws org.apache.thrift.TException { + oneWay_args args = new oneWay_args(); + sendBaseOneway("oneWay", args); + } + + public void oneWayWithError() throws org.apache.thrift.TException { + send_oneWayWithError(); + } + + public void send_oneWayWithError() throws org.apache.thrift.TException { + oneWayWithError_args args = new oneWayWithError_args(); + sendBaseOneway("oneWayWithError", args); + } + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException { + send_data(user, account); + return recv_data(); + } + + public void send_data(User user, Account account) throws org.apache.thrift.TException { + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + sendBase("data", args); + } + + public UserAccount recv_data() throws org.apache.thrift.TException { + data_result result = new data_result(); + receiveBase(result, "data"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, "data failed: unknown result"); + } + } + + public static class AsyncClient extends org.apache.thrift.async.TAsyncClient + implements AsyncIface { + public static class Factory + implements org.apache.thrift.async.TAsyncClientFactory { + private org.apache.thrift.async.TAsyncClientManager clientManager; + private org.apache.thrift.protocol.TProtocolFactory protocolFactory; + + public Factory( + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.protocol.TProtocolFactory protocolFactory) { + this.clientManager = clientManager; + this.protocolFactory = protocolFactory; + } + + public AsyncClient getAsyncClient( + org.apache.thrift.transport.TNonblockingTransport transport) { + return new AsyncClient(protocolFactory, clientManager, transport); + } + } + + public AsyncClient( + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.transport.TNonblockingTransport transport) { + super(protocolFactory, clientManager, transport); + } + + public void sayHello( + String zone, String name, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + sayHello_call method_call = + new sayHello_call(zone, name, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class sayHello_call extends org.apache.thrift.async.TAsyncMethodCall { + private String zone; + private String name; + + public sayHello_call( + String zone, + String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.zone = zone; + this.name = name; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "sayHello", org.apache.thrift.protocol.TMessageType.CALL, 0)); + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_sayHello(); + } + } + + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withDelay_call method_call = + new withDelay_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withDelay_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public withDelay_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withDelay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withDelay(); + } + } + + public void withoutArgs(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withoutArgs_call method_call = + new withoutArgs_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withoutArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + public withoutArgs_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withoutArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withoutArgs_args args = new withoutArgs_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withoutArgs(); + } + } + + public void withError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withError_call method_call = + new withError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withError_call extends org.apache.thrift.async.TAsyncMethodCall { + public withError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withError_args args = new withError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withError(); + } + } + + public void withCollisioin( + String input, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withCollisioin_call method_call = + new withCollisioin_call(input, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withCollisioin_call + extends org.apache.thrift.async.TAsyncMethodCall { + private String input; + + public withCollisioin_call( + String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.input = input; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withCollisioin", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withCollisioin(); + } + } + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + noReturn_call method_call = + new noReturn_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class noReturn_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public noReturn_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "noReturn", org.apache.thrift.protocol.TMessageType.CALL, 0)); + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayHasArgs_call method_call = + new oneWayHasArgs_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayHasArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public oneWayHasArgs_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayHasArgs", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWay_call method_call = + new oneWay_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWay_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWay_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWay", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWay_args args = new oneWay_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayWithError_call method_call = + new oneWayWithError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayWithError_call + extends org.apache.thrift.async.TAsyncMethodCall { + public oneWayWithError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayWithError", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayWithError_args args = new oneWayWithError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + data_call method_call = + new data_call(user, account, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class data_call extends org.apache.thrift.async.TAsyncMethodCall { + private User user; + private Account account; + + public data_call( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.user = user; + this.account = account; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "data", org.apache.thrift.protocol.TMessageType.CALL, 0)); + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + args.write(prot); + prot.writeMessageEnd(); + } + + public UserAccount getResult() throws org.apache.thrift.TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_data(); + } + } + } + + public static class Processor extends org.apache.thrift.TBaseProcessor + implements org.apache.thrift.TProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(Processor.class.getName()); + + public Processor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + String, + org.apache.thrift.ProcessFunction>())); + } + + protected Processor( + I iface, + java.util.Map< + String, org.apache.thrift.ProcessFunction> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + String, org.apache.thrift.ProcessFunction> + getProcessMap( + java.util.Map< + String, + org.apache.thrift.ProcessFunction> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.ProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public sayHello_result getResult(I iface, sayHello_args args) + throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + result.success = iface.sayHello(args.zone, args.name); + return result; + } + } + + public static class withDelay + extends org.apache.thrift.ProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withDelay_result getResult(I iface, withDelay_args args) + throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + result.success = iface.withDelay(args.delay); + return result; + } + } + + public static class withoutArgs + extends org.apache.thrift.ProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withoutArgs_result getResult(I iface, withoutArgs_args args) + throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + result.success = iface.withoutArgs(); + return result; + } + } + + public static class withError + extends org.apache.thrift.ProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withError_result getResult(I iface, withError_args args) + throws org.apache.thrift.TException { + withError_result result = new withError_result(); + result.success = iface.withError(); + return result; + } + } + + public static class withCollisioin + extends org.apache.thrift.ProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withCollisioin_result getResult(I iface, withCollisioin_args args) + throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + result.success = iface.withCollisioin(args.input); + return result; + } + } + + public static class noReturn + extends org.apache.thrift.ProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public noReturn_result getResult(I iface, noReturn_args args) + throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + iface.noReturn(args.delay); + return result; + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.ProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayHasArgs_args args) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay); + return null; + } + } + + public static class oneWay + extends org.apache.thrift.ProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public org.apache.thrift.TBase getResult(I iface, oneWay_args args) + throws org.apache.thrift.TException { + iface.oneWay(); + return null; + } + } + + public static class oneWayWithError + extends org.apache.thrift.ProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayWithError_args args) + throws org.apache.thrift.TException { + iface.oneWayWithError(); + return null; + } + } + + public static class data + extends org.apache.thrift.ProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public data_result getResult(I iface, data_args args) throws org.apache.thrift.TException { + data_result result = new data_result(); + result.success = iface.data(args.user, args.account); + return result; + } + } + } + + public static class AsyncProcessor + extends org.apache.thrift.TBaseAsyncProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(AsyncProcessor.class.getName()); + + public AsyncProcessor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>>())); + } + + protected AsyncProcessor( + I iface, + java.util.Map< + String, + org.apache.thrift.AsyncProcessFunction> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + String, + org.apache.thrift.AsyncProcessFunction> + getProcessMap( + java.util.Map< + String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.AsyncProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(String o) { + sayHello_result result = new sayHello_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + sayHello_result result = new sayHello_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + sayHello_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.sayHello(args.zone, args.name, resultHandler); + } + } + + public static class withDelay + extends org.apache.thrift.AsyncProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(String o) { + withDelay_result result = new withDelay_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withDelay_result result = new withDelay_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withDelay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withDelay(args.delay, resultHandler); + } + } + + public static class withoutArgs + extends org.apache.thrift.AsyncProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(String o) { + withoutArgs_result result = new withoutArgs_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withoutArgs_result result = new withoutArgs_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withoutArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withoutArgs(resultHandler); + } + } + + public static class withError + extends org.apache.thrift.AsyncProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(String o) { + withError_result result = new withError_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withError_result result = new withError_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withError(resultHandler); + } + } + + public static class withCollisioin + extends org.apache.thrift.AsyncProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(String o) { + withCollisioin_result result = new withCollisioin_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withCollisioin_result result = new withCollisioin_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withCollisioin_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withCollisioin(args.input, resultHandler); + } + } + + public static class noReturn + extends org.apache.thrift.AsyncProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) { + noReturn_result result = new noReturn_result(); + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + noReturn_result result = new noReturn_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + noReturn_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.noReturn(args.delay, resultHandler); + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.AsyncProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWayHasArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay, resultHandler); + } + } + + public static class oneWay + extends org.apache.thrift.AsyncProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWay(resultHandler); + } + } + + public static class oneWayWithError + extends org.apache.thrift.AsyncProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWayWithError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayWithError(resultHandler); + } + } + + public static class data + extends org.apache.thrift.AsyncProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(UserAccount o) { + data_result result = new data_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + data_result result = new data_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + data_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.data(args.user, args.account, resultHandler); + } + } + } + + public static class sayHello_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_args"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable String zone; // required + public @org.apache.thrift.annotation.Nullable String name; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + NAME((short) 2, "name"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // NAME + return NAME; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_args.class, metaDataMap); + } + + public sayHello_args() {} + + public sayHello_args(String zone, String name) { + this(); + this.zone = zone; + this.name = name; + } + + /** Performs a deep copy on other. */ + public sayHello_args(sayHello_args other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetName()) { + this.name = other.name; + } + } + + public sayHello_args deepCopy() { + return new sayHello_args(this); + } + + @Override + public void clear() { + this.zone = null; + this.name = null; + } + + @org.apache.thrift.annotation.Nullable + public String getZone() { + return this.zone; + } + + public sayHello_args setZone(@org.apache.thrift.annotation.Nullable String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + @org.apache.thrift.annotation.Nullable + public String getName() { + return this.name; + } + + public sayHello_args setName(@org.apache.thrift.annotation.Nullable String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((String) value); + } + break; + + case NAME: + if (value == null) { + unsetName(); + } else { + setName((String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case NAME: + return getName(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case NAME: + return isSetName(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that instanceof sayHello_args) return this.equals((sayHello_args) that); + return false; + } + + public boolean equals(sayHello_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.compare(isSetZone(), other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.compare(isSetName(), other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("sayHello_args("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_argsStandardScheme getScheme() { + return new sayHello_argsStandardScheme(); + } + } + + private static class sayHello_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_argsTupleScheme getScheme() { + return new sayHello_argsTupleScheme(); + } + } + + private static class sayHello_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetZone()) { + optionals.set(0); + } + if (struct.isSetName()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetZone()) { + oprot.writeString(struct.zone); + } + if (struct.isSetName()) { + oprot.writeString(struct.name); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } + if (incoming.get(1)) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class sayHello_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_result.class, metaDataMap); + } + + public sayHello_result() {} + + public sayHello_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public sayHello_result(sayHello_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public sayHello_result deepCopy() { + return new sayHello_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public String getSuccess() { + return this.success; + } + + public sayHello_result setSuccess(@org.apache.thrift.annotation.Nullable String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that instanceof sayHello_result) return this.equals((sayHello_result) that); + return false; + } + + public boolean equals(sayHello_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("sayHello_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_resultStandardScheme getScheme() { + return new sayHello_resultStandardScheme(); + } + } + + private static class sayHello_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_resultTupleScheme getScheme() { + return new sayHello_resultTupleScheme(); + } + } + + private static class sayHello_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withDelay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_args.class, metaDataMap); + } + + public withDelay_args() {} + + public withDelay_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public withDelay_args(withDelay_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public withDelay_args deepCopy() { + return new withDelay_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public withDelay_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that instanceof withDelay_args) return this.equals((withDelay_args) that); + return false; + } + + public boolean equals(withDelay_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(withDelay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withDelay_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_argsStandardScheme getScheme() { + return new withDelay_argsStandardScheme(); + } + } + + private static class withDelay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_argsTupleScheme getScheme() { + return new withDelay_argsTupleScheme(); + } + } + + private static class withDelay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withDelay_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_result.class, metaDataMap); + } + + public withDelay_result() {} + + public withDelay_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withDelay_result(withDelay_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withDelay_result deepCopy() { + return new withDelay_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public String getSuccess() { + return this.success; + } + + public withDelay_result setSuccess(@org.apache.thrift.annotation.Nullable String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that instanceof withDelay_result) return this.equals((withDelay_result) that); + return false; + } + + public boolean equals(withDelay_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withDelay_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withDelay_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_resultStandardScheme getScheme() { + return new withDelay_resultStandardScheme(); + } + } + + private static class withDelay_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_resultTupleScheme getScheme() { + return new withDelay_resultTupleScheme(); + } + } + + private static class withDelay_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withoutArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_args.class, metaDataMap); + } + + public withoutArgs_args() {} + + /** Performs a deep copy on other. */ + public withoutArgs_args(withoutArgs_args other) {} + + public withoutArgs_args deepCopy() { + return new withoutArgs_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that instanceof withoutArgs_args) return this.equals((withoutArgs_args) that); + return false; + } + + public boolean equals(withoutArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withoutArgs_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_argsStandardScheme getScheme() { + return new withoutArgs_argsStandardScheme(); + } + } + + private static class withoutArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_argsTupleScheme getScheme() { + return new withoutArgs_argsTupleScheme(); + } + } + + private static class withoutArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withoutArgs_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_result.class, metaDataMap); + } + + public withoutArgs_result() {} + + public withoutArgs_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withoutArgs_result(withoutArgs_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withoutArgs_result deepCopy() { + return new withoutArgs_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public String getSuccess() { + return this.success; + } + + public withoutArgs_result setSuccess(@org.apache.thrift.annotation.Nullable String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that instanceof withoutArgs_result) return this.equals((withoutArgs_result) that); + return false; + } + + public boolean equals(withoutArgs_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withoutArgs_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_resultStandardScheme getScheme() { + return new withoutArgs_resultStandardScheme(); + } + } + + private static class withoutArgs_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_resultTupleScheme getScheme() { + return new withoutArgs_resultTupleScheme(); + } + } + + private static class withoutArgs_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_args.class, metaDataMap); + } + + public withError_args() {} + + /** Performs a deep copy on other. */ + public withError_args(withError_args other) {} + + public withError_args deepCopy() { + return new withError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that instanceof withError_args) return this.equals((withError_args) that); + return false; + } + + public boolean equals(withError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_argsStandardScheme getScheme() { + return new withError_argsStandardScheme(); + } + } + + private static class withError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_argsTupleScheme getScheme() { + return new withError_argsTupleScheme(); + } + } + + private static class withError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withError_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_result.class, metaDataMap); + } + + public withError_result() {} + + public withError_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withError_result(withError_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withError_result deepCopy() { + return new withError_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public String getSuccess() { + return this.success; + } + + public withError_result setSuccess(@org.apache.thrift.annotation.Nullable String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that instanceof withError_result) return this.equals((withError_result) that); + return false; + } + + public boolean equals(withError_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withError_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withError_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_resultStandardScheme getScheme() { + return new withError_resultStandardScheme(); + } + } + + private static class withError_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_resultTupleScheme getScheme() { + return new withError_resultTupleScheme(); + } + } + + private static class withError_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withCollisioin_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_args"); + + private static final org.apache.thrift.protocol.TField INPUT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "input", org.apache.thrift.protocol.TType.STRING, (short) 3333); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable String input; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + INPUT((short) 3333, "input"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 3333: // INPUT + return INPUT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.INPUT, + new org.apache.thrift.meta_data.FieldMetaData( + "input", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_args.class, metaDataMap); + } + + public withCollisioin_args() {} + + public withCollisioin_args(String input) { + this(); + this.input = input; + } + + /** Performs a deep copy on other. */ + public withCollisioin_args(withCollisioin_args other) { + if (other.isSetInput()) { + this.input = other.input; + } + } + + public withCollisioin_args deepCopy() { + return new withCollisioin_args(this); + } + + @Override + public void clear() { + this.input = null; + } + + @org.apache.thrift.annotation.Nullable + public String getInput() { + return this.input; + } + + public withCollisioin_args setInput(@org.apache.thrift.annotation.Nullable String input) { + this.input = input; + return this; + } + + public void unsetInput() { + this.input = null; + } + + /** Returns true if field input is set (has been assigned a value) and false otherwise */ + public boolean isSetInput() { + return this.input != null; + } + + public void setInputIsSet(boolean value) { + if (!value) { + this.input = null; + } + } + + public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) { + switch (field) { + case INPUT: + if (value == null) { + unsetInput(); + } else { + setInput((String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public Object getFieldValue(_Fields field) { + switch (field) { + case INPUT: + return getInput(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case INPUT: + return isSetInput(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that instanceof withCollisioin_args) return this.equals((withCollisioin_args) that); + return false; + } + + public boolean equals(withCollisioin_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_input = true && this.isSetInput(); + boolean that_present_input = true && that.isSetInput(); + if (this_present_input || that_present_input) { + if (!(this_present_input && that_present_input)) return false; + if (!this.input.equals(that.input)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetInput()) ? 131071 : 524287); + if (isSetInput()) hashCode = hashCode * 8191 + input.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.compare(isSetInput(), other.isSetInput()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInput()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.input, other.input); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withCollisioin_args("); + boolean first = true; + + sb.append("input:"); + if (this.input == null) { + sb.append("null"); + } else { + sb.append(this.input); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_argsStandardScheme getScheme() { + return new withCollisioin_argsStandardScheme(); + } + } + + private static class withCollisioin_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 3333: // INPUT + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.input != null) { + oprot.writeFieldBegin(INPUT_FIELD_DESC); + oprot.writeString(struct.input); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_argsTupleScheme getScheme() { + return new withCollisioin_argsTupleScheme(); + } + } + + private static class withCollisioin_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetInput()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetInput()) { + oprot.writeString(struct.input); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withCollisioin_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_result.class, metaDataMap); + } + + public withCollisioin_result() {} + + public withCollisioin_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withCollisioin_result(withCollisioin_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withCollisioin_result deepCopy() { + return new withCollisioin_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public String getSuccess() { + return this.success; + } + + public withCollisioin_result setSuccess(@org.apache.thrift.annotation.Nullable String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that instanceof withCollisioin_result) return this.equals((withCollisioin_result) that); + return false; + } + + public boolean equals(withCollisioin_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withCollisioin_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_resultStandardScheme getScheme() { + return new withCollisioin_resultStandardScheme(); + } + } + + private static class withCollisioin_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_resultTupleScheme getScheme() { + return new withCollisioin_resultTupleScheme(); + } + } + + private static class withCollisioin_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class noReturn_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_args.class, metaDataMap); + } + + public noReturn_args() {} + + public noReturn_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public noReturn_args(noReturn_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public noReturn_args deepCopy() { + return new noReturn_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public noReturn_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that instanceof noReturn_args) return this.equals((noReturn_args) that); + return false; + } + + public boolean equals(noReturn_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(noReturn_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("noReturn_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_argsStandardScheme getScheme() { + return new noReturn_argsStandardScheme(); + } + } + + private static class noReturn_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_argsTupleScheme getScheme() { + return new noReturn_argsTupleScheme(); + } + } + + private static class noReturn_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class noReturn_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_result"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_resultTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_result.class, metaDataMap); + } + + public noReturn_result() {} + + /** Performs a deep copy on other. */ + public noReturn_result(noReturn_result other) {} + + public noReturn_result deepCopy() { + return new noReturn_result(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that instanceof noReturn_result) return this.equals((noReturn_result) that); + return false; + } + + public boolean equals(noReturn_result that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(noReturn_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("noReturn_result("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_resultStandardScheme getScheme() { + return new noReturn_resultStandardScheme(); + } + } + + private static class noReturn_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_resultTupleScheme getScheme() { + return new noReturn_resultTupleScheme(); + } + } + + private static class noReturn_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class oneWayHasArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayHasArgs_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayHasArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayHasArgs_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayHasArgs_args.class, metaDataMap); + } + + public oneWayHasArgs_args() {} + + public oneWayHasArgs_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public oneWayHasArgs_args(oneWayHasArgs_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public oneWayHasArgs_args deepCopy() { + return new oneWayHasArgs_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public oneWayHasArgs_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that instanceof oneWayHasArgs_args) return this.equals((oneWayHasArgs_args) that); + return false; + } + + public boolean equals(oneWayHasArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(oneWayHasArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWayHasArgs_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayHasArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayHasArgs_argsStandardScheme getScheme() { + return new oneWayHasArgs_argsStandardScheme(); + } + } + + private static class oneWayHasArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayHasArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayHasArgs_argsTupleScheme getScheme() { + return new oneWayHasArgs_argsTupleScheme(); + } + } + + private static class oneWayHasArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class oneWay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWay_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWay_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWay_args.class, metaDataMap); + } + + public oneWay_args() {} + + /** Performs a deep copy on other. */ + public oneWay_args(oneWay_args other) {} + + public oneWay_args deepCopy() { + return new oneWay_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that instanceof oneWay_args) return this.equals((oneWay_args) that); + return false; + } + + public boolean equals(oneWay_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWay_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWay_argsStandardScheme getScheme() { + return new oneWay_argsStandardScheme(); + } + } + + private static class oneWay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWay_argsTupleScheme getScheme() { + return new oneWay_argsTupleScheme(); + } + } + + private static class oneWay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class oneWayWithError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayWithError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayWithError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayWithError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayWithError_args.class, metaDataMap); + } + + public oneWayWithError_args() {} + + /** Performs a deep copy on other. */ + public oneWayWithError_args(oneWayWithError_args other) {} + + public oneWayWithError_args deepCopy() { + return new oneWayWithError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that instanceof oneWayWithError_args) return this.equals((oneWayWithError_args) that); + return false; + } + + public boolean equals(oneWayWithError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWayWithError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWayWithError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayWithError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayWithError_argsStandardScheme getScheme() { + return new oneWayWithError_argsStandardScheme(); + } + } + + private static class oneWayWithError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayWithError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayWithError_argsTupleScheme getScheme() { + return new oneWayWithError_argsTupleScheme(); + } + } + + private static class oneWayWithError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class data_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_args"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable User user; // required + public @org.apache.thrift.annotation.Nullable Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(data_args.class, metaDataMap); + } + + public data_args() {} + + public data_args(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public data_args(data_args other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public data_args deepCopy() { + return new data_args(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + @org.apache.thrift.annotation.Nullable + public User getUser() { + return this.user; + } + + public data_args setUser(@org.apache.thrift.annotation.Nullable User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + @org.apache.thrift.annotation.Nullable + public Account getAccount() { + return this.account; + } + + public data_args setAccount(@org.apache.thrift.annotation.Nullable Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that instanceof data_args) return this.equals((data_args) that); + return false; + } + + public boolean equals(data_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.compare(isSetUser(), other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.compare(isSetAccount(), other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("data_args("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_argsStandardScheme getScheme() { + return new data_argsStandardScheme(); + } + } + + private static class data_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_argsTupleScheme getScheme() { + return new data_argsTupleScheme(); + } + } + + private static class data_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetUser()) { + optionals.set(0); + } + if (struct.isSetAccount()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetUser()) { + struct.user.write(oprot); + } + if (struct.isSetAccount()) { + struct.account.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } + if (incoming.get(1)) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class data_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRUCT, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable UserAccount success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, UserAccount.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + data_result.class, metaDataMap); + } + + public data_result() {} + + public data_result(UserAccount success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public data_result(data_result other) { + if (other.isSetSuccess()) { + this.success = new UserAccount(other.success); + } + } + + public data_result deepCopy() { + return new data_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public UserAccount getSuccess() { + return this.success; + } + + public data_result setSuccess(@org.apache.thrift.annotation.Nullable UserAccount success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((UserAccount) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that instanceof data_result) return this.equals((data_result) that); + return false; + } + + public boolean equals(data_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("data_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_resultStandardScheme getScheme() { + return new data_resultStandardScheme(); + } + } + + private static class data_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_resultTupleScheme getScheme() { + return new data_resultTupleScheme(); + } + } + + private static class data_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } +} diff --git a/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/thrift/User.java b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/thrift/User.java new file mode 100644 index 000000000000..dd5511eff3e8 --- /dev/null +++ b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/thrift/User.java @@ -0,0 +1,595 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_14_0.thrift; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused", "all"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.14.0)", + date = "2025-02-27") +public class User + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("User"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "userId", org.apache.thrift.protocol.TType.STRING, (short) 2); + private static final org.apache.thrift.protocol.TField AGE_FIELD_DESC = + new org.apache.thrift.protocol.TField("age", org.apache.thrift.protocol.TType.I32, (short) 3); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable String name; // required + public @org.apache.thrift.annotation.Nullable String userId; // required + public int age; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + NAME((short) 1, "name"), + USER_ID((short) 2, "userId"), + AGE((short) 3, "age"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // NAME + return NAME; + case 2: // USER_ID + return USER_ID; + case 3: // AGE + return AGE; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __AGE_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.USER_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "userId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.AGE, + new org.apache.thrift.meta_data.FieldMetaData( + "age", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(User.class, metaDataMap); + } + + public User() {} + + public User(String name, String userId, int age) { + this(); + this.name = name; + this.userId = userId; + this.age = age; + setAgeIsSet(true); + } + + /** Performs a deep copy on other. */ + public User(User other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetName()) { + this.name = other.name; + } + if (other.isSetUserId()) { + this.userId = other.userId; + } + this.age = other.age; + } + + public User deepCopy() { + return new User(this); + } + + @Override + public void clear() { + this.name = null; + this.userId = null; + setAgeIsSet(false); + this.age = 0; + } + + @org.apache.thrift.annotation.Nullable + public String getName() { + return this.name; + } + + public User setName(@org.apache.thrift.annotation.Nullable String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + @org.apache.thrift.annotation.Nullable + public String getUserId() { + return this.userId; + } + + public User setUserId(@org.apache.thrift.annotation.Nullable String userId) { + this.userId = userId; + return this; + } + + public void unsetUserId() { + this.userId = null; + } + + /** Returns true if field userId is set (has been assigned a value) and false otherwise */ + public boolean isSetUserId() { + return this.userId != null; + } + + public void setUserIdIsSet(boolean value) { + if (!value) { + this.userId = null; + } + } + + public int getAge() { + return this.age; + } + + public User setAge(int age) { + this.age = age; + setAgeIsSet(true); + return this; + } + + public void unsetAge() { + __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __AGE_ISSET_ID); + } + + /** Returns true if field age is set (has been assigned a value) and false otherwise */ + public boolean isSetAge() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __AGE_ISSET_ID); + } + + public void setAgeIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __AGE_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) { + switch (field) { + case NAME: + if (value == null) { + unsetName(); + } else { + setName((String) value); + } + break; + + case USER_ID: + if (value == null) { + unsetUserId(); + } else { + setUserId((String) value); + } + break; + + case AGE: + if (value == null) { + unsetAge(); + } else { + setAge((Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public Object getFieldValue(_Fields field) { + switch (field) { + case NAME: + return getName(); + + case USER_ID: + return getUserId(); + + case AGE: + return getAge(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case NAME: + return isSetName(); + case USER_ID: + return isSetUserId(); + case AGE: + return isSetAge(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that instanceof User) return this.equals((User) that); + return false; + } + + public boolean equals(User that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + boolean this_present_userId = true && this.isSetUserId(); + boolean that_present_userId = true && that.isSetUserId(); + if (this_present_userId || that_present_userId) { + if (!(this_present_userId && that_present_userId)) return false; + if (!this.userId.equals(that.userId)) return false; + } + + boolean this_present_age = true; + boolean that_present_age = true; + if (this_present_age || that_present_age) { + if (!(this_present_age && that_present_age)) return false; + if (this.age != that.age) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + hashCode = hashCode * 8191 + ((isSetUserId()) ? 131071 : 524287); + if (isSetUserId()) hashCode = hashCode * 8191 + userId.hashCode(); + + hashCode = hashCode * 8191 + age; + + return hashCode; + } + + @Override + public int compareTo(User other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.compare(isSetName(), other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.compare(isSetUserId(), other.isSetUserId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.compare(isSetAge(), other.isSetAge()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAge()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.age, other.age); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("User("); + boolean first = true; + + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + if (!first) sb.append(", "); + sb.append("userId:"); + if (this.userId == null) { + sb.append("null"); + } else { + sb.append(this.userId); + } + first = false; + if (!first) sb.append(", "); + sb.append("age:"); + sb.append(this.age); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (name == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'name' was not present! Struct: " + toString()); + } + if (userId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'userId' was not present! Struct: " + toString()); + } + // alas, we cannot check 'age' because it's a primitive and you chose the non-beans generator. + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public UserStandardScheme getScheme() { + return new UserStandardScheme(); + } + } + + private static class UserStandardScheme extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // AGE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + if (!struct.isSetAge()) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'age' was not found in serialized data! Struct: " + toString()); + } + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, User struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + if (struct.userId != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userId); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(AGE_FIELD_DESC); + oprot.writeI32(struct.age); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public UserTupleScheme getScheme() { + return new UserTupleScheme(); + } + } + + private static class UserTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.name); + oprot.writeString(struct.userId); + oprot.writeI32(struct.age); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.name = iprot.readString(); + struct.setNameIsSet(true); + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/thrift/UserAccount.java b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/thrift/UserAccount.java new file mode 100644 index 000000000000..11817971ddd1 --- /dev/null +++ b/instrumentation/thrift/thrift-0.14.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_14_0/thrift/UserAccount.java @@ -0,0 +1,506 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_14_0.thrift; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused", "all"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.14.0)", + date = "2025-02-27") +public class UserAccount + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("UserAccount"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserAccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserAccountTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable User user; // required + public @org.apache.thrift.annotation.Nullable Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserAccount.class, metaDataMap); + } + + public UserAccount() {} + + public UserAccount(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public UserAccount(UserAccount other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public UserAccount deepCopy() { + return new UserAccount(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + @org.apache.thrift.annotation.Nullable + public User getUser() { + return this.user; + } + + public UserAccount setUser(@org.apache.thrift.annotation.Nullable User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + @org.apache.thrift.annotation.Nullable + public Account getAccount() { + return this.account; + } + + public UserAccount setAccount(@org.apache.thrift.annotation.Nullable Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that instanceof UserAccount) return this.equals((UserAccount) that); + return false; + } + + public boolean equals(UserAccount that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(UserAccount other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.compare(isSetUser(), other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.compare(isSetAccount(), other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("UserAccount("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (user == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'user' was not present! Struct: " + toString()); + } + if (account == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'account' was not present! Struct: " + toString()); + } + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserAccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public UserAccountStandardScheme getScheme() { + return new UserAccountStandardScheme(); + } + } + + private static class UserAccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, UserAccount struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserAccountTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public UserAccountTupleScheme getScheme() { + return new UserAccountTupleScheme(); + } + } + + private static class UserAccountTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user.write(oprot); + struct.account.write(oprot); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/build.gradle.kts b/instrumentation/thrift/thrift-0.7.0/javaagent/build.gradle.kts new file mode 100644 index 000000000000..2288d2864879 --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/build.gradle.kts @@ -0,0 +1,19 @@ +plugins { + id("otel.javaagent-instrumentation") +} + +muzzle { + pass { + group.set("org.apache.thrift") + module.set("libthrift") + versions.set("[0.7.0, 0.9.1)") + } +} + +dependencies { + compileOnly("org.apache.thrift:libthrift:0.7.0") + implementation(project(":instrumentation:thrift:thrift-common:library")) + + testImplementation("org.apache.thrift:libthrift:0.7.0") + testImplementation("javax.annotation:javax.annotation-api:1.3.2") +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/AbstractProtocolWrapper.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/AbstractProtocolWrapper.java new file mode 100644 index 000000000000..b87c2a18352d --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/AbstractProtocolWrapper.java @@ -0,0 +1,21 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0; + +import org.apache.thrift.protocol.TProtocol; + +/** + * Note that the 8888th field of record is reserved for transporting trace header. Because Thrift + * doesn't support to transport metadata. + */ +public abstract class AbstractProtocolWrapper extends TProtocolDecorator { + public static final String OT_MAGIC_FIELD = "OT_MAGIC_FIELD"; + public static final short OT_MAGIC_FIELD_ID = 8888; + + public AbstractProtocolWrapper(TProtocol protocol) { + super(protocol); + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/AsyncMethodCallbackWrapper.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/AsyncMethodCallbackWrapper.java new file mode 100644 index 000000000000..51b0bf88c90d --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/AsyncMethodCallbackWrapper.java @@ -0,0 +1,67 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0; + +import static io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.ThriftSingletons.clientInstrumenter; +import static io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.ThriftSingletons.serverInstrumenter; + +import io.opentelemetry.context.Context; +import io.opentelemetry.instrumentation.thrift.common.RequestScopeContext; +import io.opentelemetry.instrumentation.thrift.common.ThriftRequest; +import org.apache.thrift.async.AsyncMethodCallback; + +public final class AsyncMethodCallbackWrapper implements AsyncMethodCallback { + private final AsyncMethodCallback delegate; + private RequestScopeContext requestScopeContext; + private final boolean isServer; + + public AsyncMethodCallbackWrapper(AsyncMethodCallback methodCallback, boolean isServer) { + this.delegate = methodCallback; + this.isServer = isServer; + } + + public void setRequestScopeContext(RequestScopeContext requestScopeContext) { + this.requestScopeContext = requestScopeContext; + } + + @Override + public void onComplete(T t) { + try { + if (this.requestScopeContext == null) { + return; + } + this.requestScopeContext.close(); + Context context = this.requestScopeContext.getContext(); + ThriftRequest request = this.requestScopeContext.getRequest(); + if (isServer) { + serverInstrumenter().end(context, request, 0, null); + } else { + clientInstrumenter().end(context, request, 0, null); + } + } finally { + this.delegate.onComplete(t); + } + } + + @Override + public void onError(Exception e) { + try { + if (this.requestScopeContext == null) { + return; + } + this.requestScopeContext.close(); + Context context = this.requestScopeContext.getContext(); + ThriftRequest request = this.requestScopeContext.getRequest(); + if (isServer) { + serverInstrumenter().end(context, request, 1, e); + } else { + clientInstrumenter().end(context, request, 1, e); + } + } finally { + this.delegate.onError(e); + } + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/TProtocolDecorator.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/TProtocolDecorator.java new file mode 100644 index 000000000000..20aee4bff9b8 --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/TProtocolDecorator.java @@ -0,0 +1,237 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0; + +import java.nio.ByteBuffer; +import org.apache.thrift.TException; +import org.apache.thrift.protocol.TField; +import org.apache.thrift.protocol.TList; +import org.apache.thrift.protocol.TMap; +import org.apache.thrift.protocol.TMessage; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TSet; +import org.apache.thrift.protocol.TStruct; + +@SuppressWarnings("all") +public abstract class TProtocolDecorator extends TProtocol { + + private final TProtocol concreteProtocol; + + /** + * Encloses the specified protocol. + * + * @param protocol All operations will be forward to this protocol. Must be non-null. + */ + public TProtocolDecorator(TProtocol protocol) { + super(protocol.getTransport()); + concreteProtocol = protocol; + } + + @Override + public void writeMessageBegin(TMessage tMessage) throws TException { + concreteProtocol.writeMessageBegin(tMessage); + } + + @Override + public void writeMessageEnd() throws TException { + concreteProtocol.writeMessageEnd(); + } + + @Override + public void writeStructBegin(TStruct tStruct) throws TException { + concreteProtocol.writeStructBegin(tStruct); + } + + @Override + public void writeStructEnd() throws TException { + concreteProtocol.writeStructEnd(); + } + + @Override + public void writeFieldBegin(TField tField) throws TException { + concreteProtocol.writeFieldBegin(tField); + } + + @Override + public void writeFieldEnd() throws TException { + concreteProtocol.writeFieldEnd(); + } + + @Override + public void writeFieldStop() throws TException { + concreteProtocol.writeFieldStop(); + } + + @Override + public void writeMapBegin(TMap tMap) throws TException { + concreteProtocol.writeMapBegin(tMap); + } + + @Override + public void writeMapEnd() throws TException { + concreteProtocol.writeMapEnd(); + } + + @Override + public void writeListBegin(TList tList) throws TException { + concreteProtocol.writeListBegin(tList); + } + + @Override + public void writeListEnd() throws TException { + concreteProtocol.writeListEnd(); + } + + @Override + public void writeSetBegin(TSet tSet) throws TException { + concreteProtocol.writeSetBegin(tSet); + } + + @Override + public void writeSetEnd() throws TException { + concreteProtocol.writeSetEnd(); + } + + @Override + public void writeBool(boolean b) throws TException { + concreteProtocol.writeBool(b); + } + + @Override + public void writeByte(byte b) throws TException { + concreteProtocol.writeByte(b); + } + + @Override + public void writeI16(short i) throws TException { + concreteProtocol.writeI16(i); + } + + @Override + public void writeI32(int i) throws TException { + concreteProtocol.writeI32(i); + } + + @Override + public void writeI64(long l) throws TException { + concreteProtocol.writeI64(l); + } + + @Override + public void writeDouble(double v) throws TException { + concreteProtocol.writeDouble(v); + } + + @Override + public void writeString(String s) throws TException { + concreteProtocol.writeString(s); + } + + @Override + public void writeBinary(ByteBuffer buf) throws TException { + concreteProtocol.writeBinary(buf); + } + + @Override + public TMessage readMessageBegin() throws TException { + return concreteProtocol.readMessageBegin(); + } + + @Override + public void readMessageEnd() throws TException { + concreteProtocol.readMessageEnd(); + } + + @Override + public TStruct readStructBegin() throws TException { + return concreteProtocol.readStructBegin(); + } + + @Override + public void readStructEnd() throws TException { + concreteProtocol.readStructEnd(); + } + + @Override + public TField readFieldBegin() throws TException { + return concreteProtocol.readFieldBegin(); + } + + @Override + public void readFieldEnd() throws TException { + concreteProtocol.readFieldEnd(); + } + + @Override + public TMap readMapBegin() throws TException { + return concreteProtocol.readMapBegin(); + } + + @Override + public void readMapEnd() throws TException { + concreteProtocol.readMapEnd(); + } + + @Override + public TList readListBegin() throws TException { + return concreteProtocol.readListBegin(); + } + + @Override + public void readListEnd() throws TException { + concreteProtocol.readListEnd(); + } + + @Override + public TSet readSetBegin() throws TException { + return concreteProtocol.readSetBegin(); + } + + @Override + public void readSetEnd() throws TException { + concreteProtocol.readSetEnd(); + } + + @Override + public boolean readBool() throws TException { + return concreteProtocol.readBool(); + } + + @Override + public byte readByte() throws TException { + return concreteProtocol.readByte(); + } + + @Override + public short readI16() throws TException { + return concreteProtocol.readI16(); + } + + @Override + public int readI32() throws TException { + return concreteProtocol.readI32(); + } + + @Override + public long readI64() throws TException { + return concreteProtocol.readI64(); + } + + @Override + public double readDouble() throws TException { + return concreteProtocol.readDouble(); + } + + @Override + public String readString() throws TException { + return concreteProtocol.readString(); + } + + @Override + public ByteBuffer readBinary() throws TException { + return concreteProtocol.readBinary(); + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/ThriftSingletons.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/ThriftSingletons.java new file mode 100644 index 000000000000..a3e043784bb0 --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/ThriftSingletons.java @@ -0,0 +1,29 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0; + +import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; +import io.opentelemetry.instrumentation.thrift.common.ThriftInstrumenterFactory; +import io.opentelemetry.instrumentation.thrift.common.ThriftRequest; + +public final class ThriftSingletons { + private static final String INSTRUMENTATION_NAME = "io.opentelemetry.thrift-0.7.0"; + + private static final Instrumenter CLIENT_INSTRUMENTER = + ThriftInstrumenterFactory.clientInstrumenter(INSTRUMENTATION_NAME); + private static final Instrumenter SERVER_INSTRUMENTER = + ThriftInstrumenterFactory.serverInstrumenter(INSTRUMENTATION_NAME); + + public static Instrumenter clientInstrumenter() { + return CLIENT_INSTRUMENTER; + } + + public static Instrumenter serverInstrumenter() { + return SERVER_INSTRUMENTER; + } + + private ThriftSingletons() {} +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/client/ClientOutProtocolWrapper.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/client/ClientOutProtocolWrapper.java new file mode 100644 index 000000000000..526fcc576860 --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/client/ClientOutProtocolWrapper.java @@ -0,0 +1,150 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.client; + +import static io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.ThriftSingletons.clientInstrumenter; + +import io.opentelemetry.context.Context; +import io.opentelemetry.instrumentation.thrift.common.RequestScopeContext; +import io.opentelemetry.instrumentation.thrift.common.SocketAccessor; +import io.opentelemetry.instrumentation.thrift.common.ThriftRequest; +import io.opentelemetry.javaagent.bootstrap.Java8BytecodeBridge; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.AbstractProtocolWrapper; +import java.net.Socket; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import org.apache.thrift.TException; +import org.apache.thrift.protocol.TField; +import org.apache.thrift.protocol.TMap; +import org.apache.thrift.protocol.TMessage; +import org.apache.thrift.protocol.TMessageType; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TType; +import org.apache.thrift.transport.TTransport; + +public final class ClientOutProtocolWrapper extends AbstractProtocolWrapper { + public static final String ONE_WAY_METHOD_NAME_PREFIX = "recv_"; + private volatile RequestScopeContext requestScopeContext; + public TTransport transport; + private boolean injected = true; + private String methodName; + private final Set voidMethodNames; + private String serviceName; + private byte type = -1; + private byte originType; + + public ClientOutProtocolWrapper( + TProtocol protocol, String serviceName, Set voidMethodNames) { + super(protocol); + this.serviceName = serviceName; + this.voidMethodNames = voidMethodNames; + } + + @Override + public void writeMessageBegin(TMessage message) throws TException { + this.injected = false; + this.methodName = message.name; + this.originType = message.type; + // Compatible with asynchronous logic + if (message.type == TMessageType.ONEWAY || this.type == -1) { + this.type = message.type; + } + if (!this.isOneway()) { + if (this.voidMethodNames != null + && this.voidMethodNames.contains(this.methodName) + && !this.voidMethodNames.contains(ONE_WAY_METHOD_NAME_PREFIX + this.methodName)) { + this.type = TMessageType.ONEWAY; + } + } + try { + if (this.requestScopeContext == null) { + Socket socket = SocketAccessor.getSocket(super.getTransport()); + if (socket == null) { + socket = SocketAccessor.getSocket(this.transport); + } + ThriftRequest request = + ThriftRequest.create(this.serviceName, this.methodName, socket, new HashMap<>()); + Context parentContext = Java8BytecodeBridge.currentContext(); + if (!clientInstrumenter().shouldStart(parentContext, request)) { + return; + } + Context context = clientInstrumenter().start(parentContext, request); + this.requestScopeContext = RequestScopeContext.create(request, null, context); + } + } finally { + if (this.isOneway() && message.type != TMessageType.ONEWAY) { + TMessage onewayMessage = new TMessage(message.name, TMessageType.ONEWAY, message.seqid); + super.writeMessageBegin(onewayMessage); + } else { + super.writeMessageBegin(message); + } + } + } + + @Override + public void writeFieldStop() throws TException { + try { + if (!this.injected && this.requestScopeContext != null) { + ThriftRequest request = this.requestScopeContext.getRequest(); + this.writeHeader(request.getHeader()); + } + } finally { + this.injected = true; + super.writeFieldStop(); + } + } + + public void writeHeader(Map header) throws TException { + super.writeFieldBegin(new TField(OT_MAGIC_FIELD, TType.MAP, OT_MAGIC_FIELD_ID)); + super.writeMapBegin(new TMap(TType.STRING, TType.STRING, header.size())); + + Set> entries = header.entrySet(); + for (Map.Entry entry : entries) { + super.writeString(entry.getKey()); + super.writeString(entry.getValue()); + } + + super.writeMapEnd(); + super.writeFieldEnd(); + } + + public boolean isOneway() { + return this.type == TMessageType.ONEWAY; + } + + public boolean isChangeToOneway() { + return this.type != this.originType; + } + + public String getMethodName() { + return this.methodName; + } + + public void updateTransport(TTransport transport) { + this.transport = transport; + } + + public RequestScopeContext getRequestScopeContext() { + return requestScopeContext; + } + + public void setRequestScopeContext(RequestScopeContext requestScopeContext) { + this.requestScopeContext = requestScopeContext; + } + + public String getServiceName() { + return serviceName; + } + + public void setServiceName(String serviceName) { + this.serviceName = serviceName; + } + + public void setType(byte type) { + this.type = type; + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/client/ClientProtocolFactoryWrapper.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/client/ClientProtocolFactoryWrapper.java new file mode 100644 index 000000000000..18b553068cbd --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/client/ClientProtocolFactoryWrapper.java @@ -0,0 +1,41 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.client; + +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TTransport; + +@SuppressWarnings({"serial"}) +public final class ClientProtocolFactoryWrapper implements TProtocolFactory { + public TProtocolFactory delegate; + public TTransport transport; + public String serviceName; + + @Override + public TProtocol getProtocol(TTransport transport) { + TProtocol protocol = this.delegate.getProtocol(transport); + if (protocol instanceof ClientOutProtocolWrapper) { + if (transport != null) { + ((ClientOutProtocolWrapper) protocol).updateTransport(this.transport); + } + ((ClientOutProtocolWrapper) protocol).setServiceName(this.serviceName); + return protocol; + } + protocol = new ClientOutProtocolWrapper(protocol, this.serviceName, null); + if (transport != null) { + ((ClientOutProtocolWrapper) protocol).updateTransport(this.transport); + } + return protocol; + } + + public ClientProtocolFactoryWrapper( + TProtocolFactory protocolFactory, TTransport transport, String serviceName) { + this.delegate = protocolFactory; + this.transport = transport; + this.serviceName = serviceName; + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/client/ThriftAsyncClientInstrumentation.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/client/ThriftAsyncClientInstrumentation.java new file mode 100644 index 000000000000..8b4aa472925f --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/client/ThriftAsyncClientInstrumentation.java @@ -0,0 +1,44 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.client; + +import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.extendsClass; +import static net.bytebuddy.matcher.ElementMatchers.isConstructor; +import static net.bytebuddy.matcher.ElementMatchers.named; + +import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; +import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; +import net.bytebuddy.asm.Advice; +import net.bytebuddy.description.type.TypeDescription; +import net.bytebuddy.matcher.ElementMatcher; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TTransport; + +public final class ThriftAsyncClientInstrumentation implements TypeInstrumentation { + @Override + public ElementMatcher typeMatcher() { + return extendsClass(named("org.apache.thrift.async.TAsyncClient")); + } + + @Override + public void transform(TypeTransformer transformer) { + transformer.applyAdviceToMethod( + isConstructor(), ThriftAsyncClientInstrumentation.class.getName() + "$ConstructorAdvice"); + } + + public static class ConstructorAdvice { + @Advice.OnMethodEnter(suppress = Throwable.class) + public static void onEnter( + @Advice.Origin("#t") String serviceName, + @Advice.Argument(value = 0, readOnly = false) TProtocolFactory factory, + @Advice.Argument(value = 2) TTransport transport) { + if (factory instanceof ClientProtocolFactoryWrapper) { + return; + } + factory = new ClientProtocolFactoryWrapper(factory, transport, serviceName); + } + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/client/ThriftAsyncMethodCallInstrumentation.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/client/ThriftAsyncMethodCallInstrumentation.java new file mode 100644 index 000000000000..2688ef59293d --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/client/ThriftAsyncMethodCallInstrumentation.java @@ -0,0 +1,65 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.client; + +import static net.bytebuddy.matcher.ElementMatchers.isConstructor; +import static net.bytebuddy.matcher.ElementMatchers.isMethod; +import static net.bytebuddy.matcher.ElementMatchers.named; +import static net.bytebuddy.matcher.ElementMatchers.takesArgument; + +import io.opentelemetry.instrumentation.api.util.VirtualField; +import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; +import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.AsyncMethodCallbackWrapper; +import net.bytebuddy.asm.Advice; +import net.bytebuddy.description.type.TypeDescription; +import net.bytebuddy.matcher.ElementMatcher; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncMethodCall; + +public final class ThriftAsyncMethodCallInstrumentation implements TypeInstrumentation { + + @Override + public ElementMatcher typeMatcher() { + return named("org.apache.thrift.async.TAsyncMethodCall"); + } + + @Override + public void transform(TypeTransformer transformer) { + transformer.applyAdviceToMethod( + isConstructor().and(takesArgument(3, named("org.apache.thrift.async.AsyncMethodCallback"))), + ThriftAsyncMethodCallInstrumentation.class.getName() + "$ConstructorAdvice"); + + transformer.applyAdviceToMethod( + isMethod().and(named("prepareMethodCall")), + ThriftAsyncMethodCallInstrumentation.class.getName() + "$MethodCallAdvice"); + } + + public static class ConstructorAdvice { + @Advice.OnMethodEnter(suppress = Throwable.class) + public static void onEnter( + @Advice.Argument(value = 3, readOnly = false) AsyncMethodCallback callback) { + if (callback instanceof AsyncMethodCallbackWrapper) { + return; + } + callback = new AsyncMethodCallbackWrapper<>(callback, false); + } + } + + public static class MethodCallAdvice { + + @Advice.OnMethodEnter(suppress = Throwable.class) + public static void methodEnter( + @Advice.This TAsyncMethodCall thiz, + @Advice.FieldValue(value = "callback") AsyncMethodCallback callback) { + if (callback instanceof AsyncMethodCallbackWrapper) { + VirtualField, AsyncMethodCallback> virtualField = + VirtualField.find(TAsyncMethodCall.class, AsyncMethodCallback.class); + virtualField.set(thiz, callback); + } + } + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/client/ThriftAsyncWriteArgsInstrumentation.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/client/ThriftAsyncWriteArgsInstrumentation.java new file mode 100644 index 000000000000..466672b80b7b --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/client/ThriftAsyncWriteArgsInstrumentation.java @@ -0,0 +1,85 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.client; + +import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.extendsClass; +import static io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.ThriftSingletons.clientInstrumenter; +import static net.bytebuddy.matcher.ElementMatchers.isMethod; +import static net.bytebuddy.matcher.ElementMatchers.named; + +import io.opentelemetry.context.Context; +import io.opentelemetry.instrumentation.api.util.VirtualField; +import io.opentelemetry.instrumentation.thrift.common.RequestScopeContext; +import io.opentelemetry.instrumentation.thrift.common.client.MethodAccessor; +import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; +import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.AsyncMethodCallbackWrapper; +import java.util.Set; +import net.bytebuddy.asm.Advice; +import net.bytebuddy.description.type.TypeDescription; +import net.bytebuddy.matcher.ElementMatcher; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncMethodCall; +import org.apache.thrift.protocol.TMessageType; +import org.apache.thrift.protocol.TProtocol; + +public final class ThriftAsyncWriteArgsInstrumentation implements TypeInstrumentation { + + @Override + public ElementMatcher typeMatcher() { + return extendsClass(named("org.apache.thrift.async.TAsyncMethodCall")); + } + + @Override + public void transform(TypeTransformer transformer) { + transformer.applyAdviceToMethod( + isMethod().and(named("write_args")), + ThriftAsyncWriteArgsInstrumentation.class.getName() + "$WriteArgsAdvice"); + } + + public static class WriteArgsAdvice { + @Advice.OnMethodEnter(suppress = Throwable.class) + public static void methodEnter( + @Advice.Origin("#t") String serviceName, @Advice.Argument(value = 0) TProtocol protocol) { + if (protocol instanceof ClientOutProtocolWrapper) { + Set methodNames = MethodAccessor.voidMethodNames(serviceName); + // Compatible with asynchronous oneway method + if (methodNames.contains("getResult")) { + ClientOutProtocolWrapper wrapper = (ClientOutProtocolWrapper) protocol; + wrapper.setType(TMessageType.ONEWAY); + } + } + } + + @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class) + public static void methodExit( + @Advice.This TAsyncMethodCall methodCall, + @Advice.Argument(value = 0) TProtocol protocol, + @Advice.Thrown Throwable throwable) { + if (protocol instanceof ClientOutProtocolWrapper) { + ClientOutProtocolWrapper wrapper = (ClientOutProtocolWrapper) protocol; + RequestScopeContext requestScopeContext = wrapper.getRequestScopeContext(); + if (requestScopeContext == null) { + return; + } + Context context = requestScopeContext.getContext(); + if (throwable != null) { + requestScopeContext.close(); + clientInstrumenter().end(context, requestScopeContext.getRequest(), null, throwable); + wrapper.setRequestScopeContext(null); + return; + } + + VirtualField, AsyncMethodCallback> callbackVirtualField = + VirtualField.find(TAsyncMethodCall.class, AsyncMethodCallback.class); + AsyncMethodCallback callback = callbackVirtualField.get(methodCall); + if (callback instanceof AsyncMethodCallbackWrapper) { + ((AsyncMethodCallbackWrapper) callback).setRequestScopeContext(requestScopeContext); + } + } + } + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/client/ThriftClientInstrumentation.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/client/ThriftClientInstrumentation.java new file mode 100644 index 000000000000..28d791496e7e --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/client/ThriftClientInstrumentation.java @@ -0,0 +1,130 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.client; + +import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.extendsClass; +import static io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.ThriftSingletons.clientInstrumenter; +import static net.bytebuddy.matcher.ElementMatchers.isConstructor; +import static net.bytebuddy.matcher.ElementMatchers.isMethod; +import static net.bytebuddy.matcher.ElementMatchers.isProtected; +import static net.bytebuddy.matcher.ElementMatchers.named; +import static net.bytebuddy.matcher.ElementMatchers.takesArguments; + +import io.opentelemetry.context.Context; +import io.opentelemetry.instrumentation.thrift.common.RequestScopeContext; +import io.opentelemetry.instrumentation.thrift.common.client.MethodAccessor; +import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; +import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; +import java.util.Set; +import net.bytebuddy.asm.Advice; +import net.bytebuddy.description.type.TypeDescription; +import net.bytebuddy.matcher.ElementMatcher; +import org.apache.thrift.protocol.TProtocol; + +public final class ThriftClientInstrumentation implements TypeInstrumentation { + + @Override + public ElementMatcher typeMatcher() { + return extendsClass(named("org.apache.thrift.TServiceClient")); + } + + @Override + public void transform(TypeTransformer transformer) { + transformer.applyAdviceToMethod( + isConstructor().and(takesArguments(1)), + ThriftClientInstrumentation.class.getName() + "$ConstructorOneAdvice"); + + transformer.applyAdviceToMethod( + isConstructor().and(takesArguments(2)), + ThriftClientInstrumentation.class.getName() + "$ConstructorTowAdvice"); + + transformer.applyAdviceToMethod( + isMethod().and(isProtected()).and(named("sendBase")), + ThriftClientInstrumentation.class.getName() + "$ClientSendAdvice"); + + transformer.applyAdviceToMethod( + isMethod().and(named("receiveBase")), + ThriftClientInstrumentation.class.getName() + "$ClientReceiveAdvice"); + } + + public static class ConstructorOneAdvice { + @Advice.OnMethodEnter(suppress = Throwable.class) + public static void onEnter( + @Advice.Origin("#t") String serviceName, + @Advice.Argument(value = 0, readOnly = false) TProtocol inProtocol) { + Set voidMethodNames = MethodAccessor.voidMethodNames(serviceName); + if (!(inProtocol instanceof ClientOutProtocolWrapper)) { + inProtocol = new ClientOutProtocolWrapper(inProtocol, serviceName, voidMethodNames); + } + } + } + + public static class ConstructorTowAdvice { + @Advice.OnMethodEnter(suppress = Throwable.class) + public static void onEnter( + @Advice.Origin("#t") String serviceName, + @Advice.Argument(value = 0, readOnly = false) TProtocol inProtocol, + @Advice.Argument(value = 1, readOnly = false) TProtocol outProtocol) { + Set voidMethodNames = MethodAccessor.voidMethodNames(serviceName); + if (!(inProtocol instanceof ClientOutProtocolWrapper)) { + inProtocol = new ClientOutProtocolWrapper(inProtocol, serviceName, voidMethodNames); + } + if (!(outProtocol instanceof ClientOutProtocolWrapper)) { + outProtocol = new ClientOutProtocolWrapper(outProtocol, serviceName, voidMethodNames); + } + } + } + + public static class ClientSendAdvice { + @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class) + public static void methodExit( + @Advice.FieldValue(value = "oprot_") TProtocol outProtocol, + @Advice.Thrown Throwable throwable) { + if (outProtocol != null && outProtocol instanceof ClientOutProtocolWrapper) { + ClientOutProtocolWrapper wrapper = (ClientOutProtocolWrapper) outProtocol; + RequestScopeContext requestScopeContext = wrapper.getRequestScopeContext(); + if (requestScopeContext == null) { + return; + } + + Context context = requestScopeContext.getContext(); + if (throwable != null) { + requestScopeContext.close(); + clientInstrumenter().end(context, requestScopeContext.getRequest(), null, throwable); + wrapper.setRequestScopeContext(null); + return; + } + + if (wrapper.isOneway()) { + requestScopeContext.close(); + clientInstrumenter().end(context, requestScopeContext.getRequest(), 0, null); + wrapper.setRequestScopeContext(null); + } + } + } + } + + public static class ClientReceiveAdvice { + @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class) + public static void methodExit( + @Advice.Thrown Throwable throwable, + @Advice.FieldValue(value = "oprot_") TProtocol outProtocol) { + if (outProtocol != null && outProtocol instanceof ClientOutProtocolWrapper) { + ClientOutProtocolWrapper wrapper = (ClientOutProtocolWrapper) outProtocol; + RequestScopeContext requestScopeContext = wrapper.getRequestScopeContext(); + if (requestScopeContext == null) { + return; + } + + requestScopeContext.close(); + + Context context = requestScopeContext.getContext(); + clientInstrumenter().end(context, requestScopeContext.getRequest(), null, throwable); + wrapper.setRequestScopeContext(null); + } + } + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/client/ThriftClientInstrumentationModule.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/client/ThriftClientInstrumentationModule.java new file mode 100644 index 000000000000..0c42a30e92a0 --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/client/ThriftClientInstrumentationModule.java @@ -0,0 +1,39 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.client; + +import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.hasClassesNamed; +import static java.util.Arrays.asList; +import static net.bytebuddy.matcher.ElementMatchers.not; + +import com.google.auto.service.AutoService; +import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule; +import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; +import java.util.List; +import net.bytebuddy.matcher.ElementMatcher; + +@AutoService(InstrumentationModule.class) +public final class ThriftClientInstrumentationModule extends InstrumentationModule { + + public ThriftClientInstrumentationModule() { + super("thrift", "thrift-0.7.0", "thrift-0.7.0-client"); + } + + @Override + public ElementMatcher.Junction classLoaderMatcher() { + return hasClassesNamed("org.apache.thrift.TServiceClient") + .and(not(hasClassesNamed("org.apache.thrift.protocol.TProtocolDecorator"))); + } + + @Override + public List typeInstrumentations() { + return asList( + new ThriftClientInstrumentation(), + new ThriftAsyncClientInstrumentation(), + new ThriftAsyncMethodCallInstrumentation(), + new ThriftAsyncWriteArgsInstrumentation()); + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/server/ServerInProtocolWrapper.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/server/ServerInProtocolWrapper.java new file mode 100644 index 000000000000..60cbb41cd942 --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/server/ServerInProtocolWrapper.java @@ -0,0 +1,131 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.server; + +import static io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.ThriftSingletons.serverInstrumenter; + +import io.opentelemetry.context.Context; +import io.opentelemetry.context.Scope; +import io.opentelemetry.instrumentation.api.internal.Timer; +import io.opentelemetry.instrumentation.thrift.common.RequestScopeContext; +import io.opentelemetry.instrumentation.thrift.common.SocketAccessor; +import io.opentelemetry.instrumentation.thrift.common.ThriftRequest; +import io.opentelemetry.javaagent.bootstrap.Java8BytecodeBridge; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.AbstractProtocolWrapper; +import java.net.Socket; +import java.util.HashMap; +import java.util.Map; +import org.apache.thrift.TException; +import org.apache.thrift.protocol.TField; +import org.apache.thrift.protocol.TMap; +import org.apache.thrift.protocol.TMessage; +import org.apache.thrift.protocol.TMessageType; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TType; +import org.apache.thrift.transport.TTransport; + +public final class ServerInProtocolWrapper extends AbstractProtocolWrapper { + + public static final ThreadLocal CONTEXT_THREAD_LOCAL = new ThreadLocal<>(); + + private volatile RequestScopeContext requestScopeContext; + private String methodName; + private String serviceName; + private byte type; + private Timer timer; + + public ServerInProtocolWrapper(TProtocol protocol) { + super(protocol); + } + + @Override + public TMessage readMessageBegin() throws TException { + TMessage message = super.readMessageBegin(); + this.methodName = message.name; + this.type = message.type; + this.timer = Timer.start(); + return message; + } + + @Override + public TField readFieldBegin() throws TException { + TField field = super.readFieldBegin(); + if (field.id == OT_MAGIC_FIELD_ID && field.type == TType.MAP) { + try { + TMap map = super.readMapBegin(); + Map header = new HashMap<>(map.size); + + for (int i = 0; i < map.size; i++) { + header.put(readString(), readString()); + } + + Socket socket = SocketAccessor.getSocket(super.getTransport()); + if (socket == null) { + TTransport transport = CONTEXT_THREAD_LOCAL.get(); + socket = SocketAccessor.getSocket(transport); + } + ThriftRequest request = + ThriftRequest.create(this.serviceName, this.methodName, socket, header); + Context parentContext = Java8BytecodeBridge.currentContext(); + if (!serverInstrumenter().shouldStart(parentContext, request)) { + return field; + } + Context context = serverInstrumenter().start(parentContext, request); + this.requestScopeContext = RequestScopeContext.create(request, null, context); + } finally { + super.readMapEnd(); + super.readFieldEnd(); + } + return this.readFieldBegin(); + } + return field; + } + + @Override + public void readMessageEnd() throws TException { + super.readMessageEnd(); + if (this.requestScopeContext == null) { + Socket socket = SocketAccessor.getSocket(super.getTransport()); + ThriftRequest request = + ThriftRequest.create(this.serviceName, this.methodName, socket, new HashMap<>()); + Context parentContext = Java8BytecodeBridge.currentContext(); + if (!serverInstrumenter().shouldStart(parentContext, request)) { + return; + } + Context context = serverInstrumenter().start(parentContext, request); + Scope scope = context.makeCurrent(); + this.requestScopeContext = RequestScopeContext.create(request, scope, context); + } + } + + public String getMethodName() { + return methodName; + } + + public boolean isOneway() { + return type == TMessageType.ONEWAY; + } + + public RequestScopeContext getRequestScopeContext() { + return requestScopeContext; + } + + public void setRequestScopeContext(RequestScopeContext requestScopeContext) { + this.requestScopeContext = requestScopeContext; + } + + public Timer getTimer() { + return timer; + } + + public String getServiceName() { + return serviceName; + } + + public void setServiceName(String serviceName) { + this.serviceName = serviceName; + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/server/ServerProtocolFactoryWrapper.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/server/ServerProtocolFactoryWrapper.java new file mode 100644 index 000000000000..03797b1d1c50 --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/server/ServerProtocolFactoryWrapper.java @@ -0,0 +1,28 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.server; + +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TTransport; + +@SuppressWarnings({"serial"}) +public final class ServerProtocolFactoryWrapper implements TProtocolFactory { + public TProtocolFactory delegate; + + @Override + public TProtocol getProtocol(TTransport transport) { + TProtocol protocol = delegate.getProtocol(transport); + if (protocol instanceof ServerInProtocolWrapper) { + return protocol; + } + return new ServerInProtocolWrapper(protocol); + } + + public ServerProtocolFactoryWrapper(TProtocolFactory protocolFactory) { + this.delegate = protocolFactory; + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/server/ThriftBaseProcessorInstrumentation.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/server/ThriftBaseProcessorInstrumentation.java new file mode 100644 index 000000000000..eef7212d06e2 --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/server/ThriftBaseProcessorInstrumentation.java @@ -0,0 +1,69 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.server; + +import static io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.ThriftSingletons.serverInstrumenter; +import static net.bytebuddy.matcher.ElementMatchers.isMethod; +import static net.bytebuddy.matcher.ElementMatchers.named; + +import io.opentelemetry.context.Context; +import io.opentelemetry.instrumentation.thrift.common.RequestScopeContext; +import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; +import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; +import net.bytebuddy.asm.Advice; +import net.bytebuddy.description.type.TypeDescription; +import net.bytebuddy.matcher.ElementMatcher; +import org.apache.thrift.protocol.TProtocol; + +public final class ThriftBaseProcessorInstrumentation implements TypeInstrumentation { + + @Override + public ElementMatcher typeMatcher() { + return named("org.apache.thrift.TBaseProcessor"); + } + + @Override + public void transform(TypeTransformer transformer) { + transformer.applyAdviceToMethod( + isMethod().and(named("process")), + ThriftBaseProcessorInstrumentation.class.getName() + "$ProcessAdvice"); + } + + public static class ProcessAdvice { + + @Advice.OnMethodEnter(suppress = Throwable.class) + public static void methodEnter( + @Advice.Argument(value = 0) TProtocol inProtocol, + @Advice.FieldValue(value = "iface") Object iface) { + String serviceName = iface.getClass().getName(); + if (inProtocol instanceof ServerInProtocolWrapper) { + ServerInProtocolWrapper wrapper = (ServerInProtocolWrapper) inProtocol; + wrapper.setServiceName(serviceName); + } + } + + @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class) + public static void methodExit( + @Advice.Argument(value = 0) TProtocol inProtocol, @Advice.Thrown Throwable throwable) { + if (inProtocol instanceof ServerInProtocolWrapper) { + ServerInProtocolWrapper wrapper = (ServerInProtocolWrapper) inProtocol; + String methodName = wrapper.getMethodName(); + if (methodName == null || methodName.isEmpty()) { + return; + } + RequestScopeContext requestScopeContext = wrapper.getRequestScopeContext(); + if (requestScopeContext == null) { + return; + } + + requestScopeContext.close(); + Context context = requestScopeContext.getContext(); + serverInstrumenter().end(context, requestScopeContext.getRequest(), null, throwable); + wrapper.setRequestScopeContext(null); + } + } + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/server/ThriftFrameBufferInstrumentation.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/server/ThriftFrameBufferInstrumentation.java new file mode 100644 index 000000000000..1089100ae78d --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/server/ThriftFrameBufferInstrumentation.java @@ -0,0 +1,46 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.server; + +import static net.bytebuddy.matcher.ElementMatchers.isMethod; +import static net.bytebuddy.matcher.ElementMatchers.named; + +import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; +import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; +import net.bytebuddy.asm.Advice; +import net.bytebuddy.description.type.TypeDescription; +import net.bytebuddy.matcher.ElementMatcher; +import org.apache.thrift.transport.TNonblockingTransport; + +public final class ThriftFrameBufferInstrumentation implements TypeInstrumentation { + + @Override + public ElementMatcher typeMatcher() { + return named("org.apache.thrift.server.TNonblockingServer$FrameBuffer") + .or(named("org.apache.thrift.server.AbstractNonblockingServer$FrameBuffer")); + } + + @Override + public void transform(TypeTransformer transformer) { + transformer.applyAdviceToMethod( + isMethod().and(named("invoke")), + ThriftFrameBufferInstrumentation.class.getName() + "$InvokeAdvice"); + } + + public static class InvokeAdvice { + + @Advice.OnMethodEnter(suppress = Throwable.class) + public static void methodEnter( + @Advice.FieldValue(value = "trans_") TNonblockingTransport transport) { + ServerInProtocolWrapper.CONTEXT_THREAD_LOCAL.set(transport); + } + + @Advice.OnMethodExit(suppress = Throwable.class) + public static void methodExist() { + ServerInProtocolWrapper.CONTEXT_THREAD_LOCAL.remove(); + } + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/server/ThriftServerInstrumentation.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/server/ThriftServerInstrumentation.java new file mode 100644 index 000000000000..5194fb750c9c --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/server/ThriftServerInstrumentation.java @@ -0,0 +1,44 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.server; + +import static net.bytebuddy.matcher.ElementMatchers.isConstructor; +import static net.bytebuddy.matcher.ElementMatchers.named; +import static net.bytebuddy.matcher.ElementMatchers.takesArguments; + +import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; +import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; +import net.bytebuddy.asm.Advice; +import net.bytebuddy.description.type.TypeDescription; +import net.bytebuddy.matcher.ElementMatcher; +import org.apache.thrift.protocol.TProtocolFactory; + +public final class ThriftServerInstrumentation implements TypeInstrumentation { + @Override + public ElementMatcher typeMatcher() { + return named("org.apache.thrift.server.TServer"); + } + + @Override + public void transform(TypeTransformer transformer) { + transformer.applyAdviceToMethod( + isConstructor().and(takesArguments(1)), + ThriftServerInstrumentation.class.getName() + "$ServerConstructorAdvice"); + } + + public static class ServerConstructorAdvice { + + @Advice.OnMethodExit(suppress = Throwable.class) + public static void onExit( + @Advice.FieldValue(value = "inputProtocolFactory_", readOnly = false) + TProtocolFactory factory) { + if (factory instanceof ServerProtocolFactoryWrapper) { + return; + } + factory = new ServerProtocolFactoryWrapper(factory); + } + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/server/ThriftServerInstrumentationModule.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/server/ThriftServerInstrumentationModule.java new file mode 100644 index 000000000000..db594ec186d5 --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/server/ThriftServerInstrumentationModule.java @@ -0,0 +1,39 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.server; + +import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.hasClassesNamed; +import static java.util.Arrays.asList; +import static net.bytebuddy.matcher.ElementMatchers.not; + +import com.google.auto.service.AutoService; +import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule; +import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; +import java.util.List; +import net.bytebuddy.matcher.ElementMatcher; + +@AutoService(InstrumentationModule.class) +public final class ThriftServerInstrumentationModule extends InstrumentationModule { + + public ThriftServerInstrumentationModule() { + super("thrift", "thrift-0.7.0", "thrift-0.7.0-server"); + } + + @Override + public ElementMatcher.Junction classLoaderMatcher() { + return hasClassesNamed("org.apache.thrift.TServiceClient") + .and(not(hasClassesNamed("org.apache.thrift.protocol.TProtocolDecorator"))); + } + + @Override + public List typeInstrumentations() { + return asList( + new ThriftServerInstrumentation(), + new ThriftServletInstrumentation(), + new ThriftFrameBufferInstrumentation(), + new ThriftBaseProcessorInstrumentation()); + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/server/ThriftServletInstrumentation.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/server/ThriftServletInstrumentation.java new file mode 100644 index 000000000000..bf9809afa13b --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/server/ThriftServletInstrumentation.java @@ -0,0 +1,43 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.server; + +import static net.bytebuddy.matcher.ElementMatchers.isConstructor; +import static net.bytebuddy.matcher.ElementMatchers.named; +import static net.bytebuddy.matcher.ElementMatchers.takesArguments; + +import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; +import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; +import net.bytebuddy.asm.Advice; +import net.bytebuddy.description.type.TypeDescription; +import net.bytebuddy.matcher.ElementMatcher; +import org.apache.thrift.protocol.TProtocolFactory; + +public final class ThriftServletInstrumentation implements TypeInstrumentation { + @Override + public ElementMatcher typeMatcher() { + return named("org.apache.thrift.server.TServlet"); + } + + @Override + public void transform(TypeTransformer transformer) { + transformer.applyAdviceToMethod( + isConstructor().and(takesArguments(1)), + ThriftServletInstrumentation.class.getName() + "$ServerConstructorAdvice"); + } + + public static class ServerConstructorAdvice { + + @Advice.OnMethodEnter(suppress = Throwable.class) + public static void onEnter( + @Advice.Argument(value = 1, readOnly = false) TProtocolFactory factory) { + if (factory instanceof ServerProtocolFactoryWrapper) { + return; + } + factory = new ServerProtocolFactoryWrapper(factory); + } + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/NoReturnTest.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/NoReturnTest.java new file mode 100644 index 000000000000..364b26df2be7 --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/NoReturnTest.java @@ -0,0 +1,496 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0; + +import com.google.common.base.VerifyException; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFastFramedTransport; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class NoReturnTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + this.syncClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncClientSyncSimpleServerNoReturnMuti() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientNoReturn(port); + } + this.waitAndAssertTracesClientSyncServerSync("noReturn", 5); + } + + @Test + public void syncClientSyncSimpleServerNoReturnParallel() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientNoReturn(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerNoReturnParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("noReturn", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerNoReturn() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncClientSyncThreadPoolServerNoReturnMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientNoReturn(port); + } + this.waitAndAssertTracesClientSyncServerSync("noReturn", 5); + } + + @Test + public void syncClientSyncThreadPoolServerNoReturnParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientNoReturn(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerNoReturnParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("noReturn", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFastFramedClientSyncNonblockingServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncFastFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFramedClientSyncNonblockingFastServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncNonblockingFastServer(port); + this.syncFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFastFramedClientSyncNonblockingFastServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncNonblockingFastServer(port); + this.syncFastFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerNoReturnMuti() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + for (int i = 0; i < 5; ++i) { + this.syncFramedClientNoReturn(port); + } + this.waitAndAssertTracesClientSyncServerSync("noReturn", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerNoReturnParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientNoReturn(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("noReturn", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFastFramedClientSyncHsHaServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncFastFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFramedClientSyncHsHaFastServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncHsHaFastServer(port); + this.syncFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFastFramedClientSyncHsHaFastServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncHsHaFastServer(port); + this.syncFastFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerNoReturnMuti() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientNoReturn(port); + } + + this.waitAndAssertTracesClientSyncServerSync("noReturn", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerNoReturnParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientNoReturn(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("noReturn", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerNoReturn() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.nonBlockClientNoReturn(port); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerNoReturnMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientNoReturn(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerNoReturnParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientNoReturn(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerNoReturn() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.nonBlockClientNoReturn(port); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerNoReturnMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientNoReturn(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerNoReturnParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientNoReturn(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", threadCount); + } + + @Test + public void syncClientSyncNonblockingServerNoReturnError() { + int port = super.getPort(); + Exception error = null; + try { + this.startSyncNonblockingServer(port); + this.syncClientNoReturn(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("noReturn", 1); + } + + @Test + public void syncClientSyncHsHaServerNoReturnError() { + int port = super.getPort(); + Exception error = null; + try { + this.startSyncHsHaServer(port); + this.syncClientNoReturn(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("noReturn", 1); + } + + public void syncClientNoReturn(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.noReturn(1)); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientNoReturn(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.noReturn_call s) {} + + @Override + public void onError(Exception e) { + throw new VerifyException("nonBlockClientNoReturn test failed", e); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.noReturn(1, callback)); + } + + public void syncFramedClientNoReturn(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.noReturn(1)); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFastFramedClientNoReturn(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFastFramedTransport framedTransport = new TFastFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.noReturn(1)); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientNoReturn(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.noReturn(1)); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/OneWayErrorTest.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/OneWayErrorTest.java new file mode 100644 index 000000000000..2b6af5a55d87 --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/OneWayErrorTest.java @@ -0,0 +1,437 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0; + +import com.google.common.base.VerifyException; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class OneWayErrorTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerOneWayWithError() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + this.syncClientOneWayWithError(port); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void syncClientSyncSimpleServerOneWayWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientOneWayWithError(port); + } + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void syncClientSyncSimpleServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientOneWayWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerOneWayWithError() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientOneWayWithError(port); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void syncClientSyncThreadPoolServerOneWayWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientOneWayWithError(port); + } + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void syncClientSyncThreadPoolServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientOneWayWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWayWithError() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncFramedClientOneWayWithError(port); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWayWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWayWithError(port); + } + + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWayWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWayWithError() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncFramedClientOneWayWithError(port); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWayWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWayWithError(port); + } + + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWayWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWayWithError() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.nonBlockClientOneWayWithError(port); + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWayWithErrorMuti() + throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWayWithError(port); + } + + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWayWithError(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWayWithError() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.nonBlockClientOneWayWithError(port); + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWayWithErrorMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWayWithError(port); + } + + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWayWithError(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void syncClientSyncNonblockingServerOneWayWithErrorError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncClientOneWayWithError(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWayWithError", 1); + } + + @Test + public void syncClientSyncHsHaServerOneWayWithErrorError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncClientOneWayWithError(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWayWithError", 1); + } + + public void syncClientOneWayWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.oneWayWithError()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientOneWayWithError(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.oneWayWithError_call no) {} + + @Override + public void onError(Exception e) { + throw new VerifyException("nonBlockClientOneWayWithError test failed", e); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.oneWayWithError(callback)); + } + + public void syncFramedClientOneWayWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.oneWayWithError()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientOneWayWithError(int port) throws IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.oneWayWithError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/OneWayTest.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/OneWayTest.java new file mode 100644 index 000000000000..074e44085578 --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/OneWayTest.java @@ -0,0 +1,432 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0; + +import com.google.common.base.VerifyException; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class OneWayTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerOneWay() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + this.syncClientOneWay(port); + this.waitAndAssertTracesClientSyncServerSyncOneWay("oneWay", 1); + } + + @Test + public void syncClientSyncSimpleServerOneWayMuti() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientOneWay(port); + } + this.waitAndAssertTracesClientSyncServerSyncOneWay("oneWay", 5); + } + + @Test + public void syncClientSyncSimpleServerOneWayParallel() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientOneWay(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOneWay("oneWay", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerOneWay() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientOneWay(port); + this.waitAndAssertTracesClientSyncServerSyncOneWay("oneWay", 1); + } + + @Test + public void syncClientSyncThreadPoolServerOneWayMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientOneWay(port); + } + this.waitAndAssertTracesClientSyncServerSyncOneWay("oneWay", 5); + } + + @Test + public void syncClientSyncThreadPoolServerOneWayParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientOneWay(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOneWay("oneWay", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWay() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncFramedClientOneWay(port); + this.waitAndAssertTracesClientSyncServerSyncOneWay("oneWay", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWayMuti() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWay(port); + } + + this.waitAndAssertTracesClientSyncServerSyncOneWay("oneWay", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWayParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWay(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOneWay("oneWay", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWay() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncFramedClientOneWay(port); + this.waitAndAssertTracesClientSyncServerSyncOneWay("oneWay", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWayMuti() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWay(port); + } + + this.waitAndAssertTracesClientSyncServerSyncOneWay("oneWay", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWayParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWay(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOneWay("oneWay", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWay() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.nonBlockClientOneWay(port); + this.waitAndAssertTracesClientAsyncServerSyncOneWay("oneWay", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWayMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWay(port); + } + + this.waitAndAssertTracesClientAsyncServerSyncOneWay("oneWay", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWayParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWay(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncOneWay("oneWay", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWay() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.nonBlockClientOneWay(port); + this.waitAndAssertTracesClientAsyncServerSyncOneWay("oneWay", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWayMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWay(port); + } + + this.waitAndAssertTracesClientAsyncServerSyncOneWay("oneWay", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWayParallel() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWay(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncOneWay("oneWay", threadCount); + } + + @Test + public void syncClientSyncNonblockingServerOneWayError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncClientOneWay(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWay", 1); + } + + @Test + public void syncClientSyncHsHaServerOneWayError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncClientOneWay(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWay", 1); + } + + public void syncClientOneWay(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.oneWay()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientOneWay(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.oneWay_call no) {} + + @Override + public void onError(Exception e) { + throw new VerifyException("nonBlockClientOneWay test failed", e); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.oneWay(callback)); + } + + public void syncFramedClientOneWay(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.oneWay()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientOneWay(int port) throws IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.oneWay()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/SayHelloTest.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/SayHelloTest.java new file mode 100644 index 000000000000..a7cc1c2e552e --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/SayHelloTest.java @@ -0,0 +1,506 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0; + +import com.google.common.base.VerifyException; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFastFramedTransport; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class SayHelloTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + this.syncClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncClientSyncSimpleServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientSayHello(port); + } + this.waitAndAssertTracesClientSyncServerSync("sayHello", 5); + } + + @Test + public void syncClientSyncSimpleServerSayHelloParallel() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientSayHello(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("sayHello", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerSayHello() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncClientSyncThreadPoolServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientSayHello(port); + } + this.waitAndAssertTracesClientSyncServerSync("sayHello", 5); + } + + @Test + public void syncClientSyncThreadPoolServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientSayHello(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("sayHello", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFastFramedClientSyncNonblockingServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncFastFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFramedClientSyncNonblockingFastServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncNonblockingFastServer(port); + this.syncFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFastFramedClientSyncNonblockingFastServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncNonblockingFastServer(port); + this.syncFastFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + for (int i = 0; i < 5; ++i) { + this.syncFramedClientSayHello(port); + } + this.waitAndAssertTracesClientSyncServerSync("sayHello", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientSayHello(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("sayHello", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFastFramedClientSyncHsHaServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncFastFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFramedClientSyncHsHaFastServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncHsHaFastServer(port); + this.syncFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFastFramedClientSyncHsHaFastServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncHsHaFastServer(port); + this.syncFastFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientSayHello(port); + } + + this.waitAndAssertTracesClientSyncServerSync("sayHello", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientSayHello(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("sayHello", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHello() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.nonBlockClientSayHello(port); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHelloMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientSayHello(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientSayHello(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHello() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.nonBlockClientSayHello(port); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHelloMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientSayHello(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientSayHello(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", threadCount); + } + + @Test + public void syncClientSyncNonblockingServerSayHelloError() { + int port = super.getPort(); + Exception error = null; + try { + this.startSyncNonblockingServer(port); + this.syncClientSayHello(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("sayHello", 1); + } + + @Test + public void syncClientSyncHsHaServerSayHelloError() { + int port = super.getPort(); + Exception error = null; + try { + this.startSyncHsHaServer(port); + this.syncClientSayHello(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("sayHello", 1); + } + + public void syncClientSayHello(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.sayHello("US", "Bob")); + Assertions.assertThat(response).isEqualTo("Hello USs' Bob"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientSayHello(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.sayHello_call s) { + try { + String result = s.getResult(); + Assertions.assertThat(result).isEqualTo("Hello USs' Bob"); + } catch (TException e) { + throw new VerifyException(e); + } + } + + @Override + public void onError(Exception e) { + throw new VerifyException("nonBlockClientSayHello test failed", e); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.sayHello("US", "Bob", callback)); + } + + public void syncFramedClientSayHello(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.sayHello("US", "Bob")); + Assertions.assertThat(response).isEqualTo("Hello USs' Bob"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFastFramedClientSayHello(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFastFramedTransport framedTransport = new TFastFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.sayHello("US", "Bob")); + Assertions.assertThat(response).isEqualTo("Hello USs' Bob"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientSayHello(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.sayHello("US", "Bob")); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/TestSaslCallbackHandler.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/TestSaslCallbackHandler.java new file mode 100644 index 000000000000..8af2b60da6c4 --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/TestSaslCallbackHandler.java @@ -0,0 +1,47 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0; + +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.NameCallback; +import javax.security.auth.callback.PasswordCallback; +import javax.security.auth.callback.UnsupportedCallbackException; +import javax.security.sasl.AuthorizeCallback; +import javax.security.sasl.RealmCallback; + +public class TestSaslCallbackHandler implements CallbackHandler { + public static final String PRINCIPAL = "thrift-test-principal"; + public static final String REALM = "thrift-test-realm"; + private final String password; + + public TestSaslCallbackHandler(String password) { + this.password = password; + } + + @Override + public void handle(Callback[] callbacks) throws UnsupportedCallbackException { + Callback[] var2 = callbacks; + int var3 = callbacks.length; + + for (int var4 = 0; var4 < var3; ++var4) { + Callback c = var2[var4]; + if (c instanceof NameCallback) { + ((NameCallback) c).setName("thrift-test-principal"); + } else if (c instanceof PasswordCallback) { + ((PasswordCallback) c).setPassword(this.password.toCharArray()); + } else if (c instanceof AuthorizeCallback) { + ((AuthorizeCallback) c).setAuthorized(true); + } else { + if (!(c instanceof RealmCallback)) { + throw new UnsupportedCallbackException(c); + } + + ((RealmCallback) c).setText("thrift-test-realm"); + } + } + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/ThriftBaseTest.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/ThriftBaseTest.java new file mode 100644 index 000000000000..893dbd2f58c6 --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/ThriftBaseTest.java @@ -0,0 +1,749 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0; + +import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo; +import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.satisfies; + +import com.google.common.base.VerifyException; +import io.opentelemetry.api.common.AttributeKey; +import io.opentelemetry.api.trace.SpanKind; +import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension; +import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.server.ThriftServiceImpl; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.thrift.ThriftService; +import io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions; +import io.opentelemetry.sdk.testing.assertj.SpanDataAssert; +import io.opentelemetry.sdk.testing.assertj.TraceAssert; +import io.opentelemetry.sdk.trace.data.StatusData; +import io.opentelemetry.semconv.SemanticAttributes; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.nio.charset.Charset; +import java.util.Random; +import java.util.function.Consumer; +import java.util.logging.Logger; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.server.THsHaServer; +import org.apache.thrift.server.TNonblockingServer; +import org.apache.thrift.server.TServer; +import org.apache.thrift.server.TSimpleServer; +import org.apache.thrift.server.TThreadPoolServer; +import org.apache.thrift.transport.TFastFramedTransport; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingServerSocket; +import org.apache.thrift.transport.TNonblockingServerTransport; +import org.apache.thrift.transport.TServerSocket; +import org.apache.thrift.transport.TServerTransport; +import org.apache.thrift.transport.TTransportException; +import org.assertj.core.api.AbstractAssert; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.extension.RegisterExtension; + +public abstract class ThriftBaseTest { + private static final Logger logger = Logger.getLogger(ThriftBaseTest.class.getName()); + public TServer server; + public int port = 13100; + + private static final String ASYNC_CLIENT = + "io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.thrift.ThriftService$AsyncClient"; + private static final String SYNC_CLIENT = + "io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.thrift.ThriftService$Client"; + private static final String ASYNC_SERVER = + "io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.server.ThriftServiceAsyncImpl"; + private static final String SYNC_SERVER = + "io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.server.ThriftServiceImpl"; + private static final String PEER_NAME = "localhost"; + private static final String PEER_ADDR = "127.0.0.1"; + + private static final String TRANSPORT_EXCEPTION = + "org.apache.thrift.transport.TTransportException"; + private static final String VERIFY_EXCEPTION = "com.google.common.base.VerifyException"; + // private static final String APP_EXCEPTION = "org.apache.thrift.TApplicationException"; + private static final String IO_EXCEPTION = "java.io.IOException"; + private static final String NULL_EXCEPTION = "java.lang.NullPointerException"; + + @RegisterExtension + protected static InstrumentationExtension testing = AgentInstrumentationExtension.create(); + + protected InstrumentationExtension testing() { + return testing; + } + + @BeforeEach + public void before() throws InterruptedException, IOException { + ++this.port; + logger.info( + "before port=" + + this.port + + ", threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.testing().clearData(); + } + + @AfterEach + public void after() throws InterruptedException, IOException { + this.stopServer(); + } + + public int getPort() { + Random random = new Random(); + int newPort = this.port + random.nextInt(2000); + while (portNotRelease(newPort)) { + newPort = this.port + random.nextInt(2000); + } + return newPort; + } + + public void startSyncSimpleServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TServerTransport serverTransport = new TServerSocket(port); + this.server = new TSimpleServer(new TServer.Args(serverTransport).processor(processor)); + new Thread( + () -> { + logger.info( + "Starting startSyncSimpleServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startSyncNonblockingServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerSocket transport = new TNonblockingServerSocket(port); + TNonblockingServer.Args serverArgs = + new TNonblockingServer.Args(transport).processor(processor); + this.server = new TNonblockingServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startNonBlockingServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startSyncNonblockingFastServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TNonblockingServer.Args serverArgs = + new TNonblockingServer.Args(transport) + .processor(processor) + .transportFactory(new TFastFramedTransport.Factory()) + .protocolFactory(new TBinaryProtocol.Factory()); + this.server = new TNonblockingServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startNonBlockingServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startSyncThreadPoolServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TServerSocket transport = new TServerSocket(port); + TThreadPoolServer.Args serverArgs = new TThreadPoolServer.Args(transport).processor(processor); + TServer server = new TThreadPoolServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startSyncThreadPoolServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + server.serve(); + }) + .start(); + } + + public void startSyncHsHaServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TBinaryProtocol.Factory protocolFactory = new TBinaryProtocol.Factory(); + TFramedTransport.Factory transportFactory = new TFramedTransport.Factory(); + THsHaServer.Args serverArgs = + new THsHaServer.Args(transport) + .processor(processor) + .protocolFactory(protocolFactory) + .transportFactory(transportFactory); + this.server = new THsHaServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startSyncTHsHaServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startSyncHsHaFastServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TBinaryProtocol.Factory protocolFactory = new TBinaryProtocol.Factory(); + TFastFramedTransport.Factory transportFactory = new TFastFramedTransport.Factory(); + THsHaServer.Args serverArgs = + new THsHaServer.Args(transport) + .processor(processor) + .protocolFactory(protocolFactory) + .transportFactory(transportFactory); + this.server = new THsHaServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startSyncTHsHaServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + @SuppressWarnings("Interruption") + public void stopServer() { + if (this.server != null) { + this.server.stop(); + } + } + + public static boolean portNotRelease(int port) { + // 查找占用端口的进程 ID + Process process = null; + String pid = null; // 获取 PID + try { + process = Runtime.getRuntime().exec("lsof -ti:" + port); + BufferedReader reader = + new BufferedReader( + new InputStreamReader(process.getInputStream(), Charset.defaultCharset())); + pid = reader.readLine(); + } catch (IOException e) { + throw new VerifyException(e); + } + return pid != null && !pid.isEmpty(); + } + + public void waitAndAssertTracesClientSyncServerSync(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.unset(), + null, + null); + } + + public void waitAndAssertTracesClientSyncServerSync( + String clientMethod, String serverMethod, int count) { + this.baseWaitAndAssertTraces( + clientMethod, + serverMethod, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.unset(), + null, + null); + } + + public void waitAndAssertTracesClientSyncServerSyncOneWay(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.error(), + val -> + val.isIn( + "Cannot invoke \"org.apache.thrift.TBase.write(org.apache.thrift.protocol.TProtocol)\" because \"result\" is null"), + NULL_EXCEPTION); + } + + @SuppressWarnings("UngroupedOverloads") + public void waitAndAssertTracesClientSyncServerSyncWithError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> val.isIn(null, "Internal error processing " + method), + TRANSPORT_EXCEPTION, + SYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientSyncServerSyncWithError( + String clientMethod, String serverMethod, int count) { + this.baseWaitAndAssertTraces( + clientMethod, + serverMethod, + count, + SYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> val.isIn(null, "Internal error processing " + clientMethod), + TRANSPORT_EXCEPTION, + SYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientSyncServerSyncOnewayError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientSyncServerSyncOnewayError( + String clientMethod, String serverMethod, int count) { + this.baseWaitAndAssertTraces( + clientMethod, + serverMethod, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientAsyncServerAsync(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + ASYNC_SERVER, + StatusData.unset(), + null, + null); + } + + public void waitAndAssertTracesClientAsyncServerAsyncError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + ASYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientAsyncServerAsyncWithError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> val.isIn("Read call frame size failed", "fail"), + IO_EXCEPTION, + ASYNC_SERVER, + StatusData.error(), + val -> val.isIn("Read call frame size failed", "fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientAsyncServerSync(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.unset(), + null, + null); + } + + public void waitAndAssertTracesClientAsyncServerSyncOneWay(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.error(), + val -> + val.isIn( + "Cannot invoke \"org.apache.thrift.TBase.write(org.apache.thrift.protocol.TProtocol)\" because \"result\" is null"), + NULL_EXCEPTION); + } + + public void waitAndAssertTracesClientAsyncServerSyncWithError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> val.isIn("Read call frame size failed", "Internal error processing " + method), + IO_EXCEPTION, + SYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientAsyncServerSyncOnewayError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) // 测试代码 + public void waitAndAssertTracesClientSyncServerAsync(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + ASYNC_SERVER, + StatusData.unset(), + null, + null); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) // 测试代码 + public void waitAndAssertTracesClientSyncServerAsyncError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + ASYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) // 测试代码 + public void waitAndAssertTracesClientSyncServerAsyncWithError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> val.isIn(null, "fail"), + TRANSPORT_EXCEPTION, + ASYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientSyncNoServer(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> + val.isIn( + null, "Socket is closed by peer.", "java.net.SocketException: Connection reset"), + TRANSPORT_EXCEPTION, + null, + null, + null, + null); + } + + public void waitAndAssertTracesClientSyncNoServerOneway(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + null, + null, + null, + null); + } + + public void waitAndAssertTracesClientSyncNoServerNoSasl(String method, int count) { + this.baseWaitAndAssertTraces( + method, + null, + count, + SYNC_CLIENT, + StatusData.error(), + null, + null, + val -> val.isIn("SASL authentication not complete"), + TRANSPORT_EXCEPTION, + null, + null, + null, + null); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) // 测试代码 + private void baseWaitAndAssertTraces( + String clientMethod, + String serverMethod, + int count, + String clientClass, + StatusData clientStatus, + String peerName, + String peerAddr, + OpenTelemetryAssertions.StringAssertConsumer clientAssertion, + String clientErrorType, + String serverClass, + StatusData serverStatus, + OpenTelemetryAssertions.StringAssertConsumer serviceAssertion, + String serverErrorType) { + Consumer[] consumers = new Consumer[count]; + Consumer traceAssertConsumer; + if (serverClass == null) { + traceAssertConsumer = + trace -> + trace.hasSpansSatisfyingExactly( + span -> span.hasName("parent").hasKind(SpanKind.INTERNAL).hasNoParent(), + clientSpanDataAssertConsumer( + clientMethod, + clientClass, + clientStatus, + trace, + peerName, + peerAddr, + clientAssertion, + clientErrorType)); + } else { + traceAssertConsumer = + trace -> + trace.hasSpansSatisfyingExactly( + span -> span.hasName("parent").hasKind(SpanKind.INTERNAL).hasNoParent(), + clientSpanDataAssertConsumer( + clientMethod, + clientClass, + clientStatus, + trace, + peerName, + peerAddr, + clientAssertion, + clientErrorType), + serverSpanDataAssertConsumer( + serverMethod, + serverClass, + serverStatus, + trace, + serviceAssertion, + serverErrorType)); + } + + for (int i = 0; i < count; ++i) { + consumers[i] = traceAssertConsumer; + } + this.testing().waitAndAssertTraces(consumers); + } + + @SuppressWarnings({"ReturnValueIgnored"}) + private static Consumer clientSpanDataAssertConsumer( + String clientMethod, + String clientClass, + StatusData statusData, + TraceAssert trace, + String peerName, + String peerAddr, + OpenTelemetryAssertions.StringAssertConsumer errorMsgAssertion, + String errorType) { + Consumer consumer = + span -> + span.hasName(clientMethod) + .hasKind(SpanKind.CLIENT) + .hasParent(trace.getSpan(0)) + .hasStatus(statusData) + .hasAttributesSatisfying( + equalTo(AttributeKey.stringKey("net.sock.peer.name"), peerName), + equalTo(AttributeKey.stringKey("net.sock.peer.addr"), peerAddr), + equalTo(SemanticAttributes.RPC_SYSTEM, "thrift"), + equalTo(SemanticAttributes.RPC_SERVICE, clientClass), + equalTo(SemanticAttributes.RPC_METHOD, clientMethod)); + if (statusData == StatusData.error()) { + consumer = + consumer.andThen( + span -> + span.hasEventsSatisfyingExactly( + event -> + event + .hasName(SemanticAttributes.EXCEPTION_EVENT_NAME) + .hasAttributesSatisfyingExactly( + satisfies( + SemanticAttributes.EXCEPTION_MESSAGE, errorMsgAssertion), + satisfies( + AttributeKey.stringKey("exception.stacktrace"), + AbstractAssert::isNotNull), + equalTo(SemanticAttributes.EXCEPTION_TYPE, errorType)))); + } + return consumer; + } + + @SuppressWarnings({"ReturnValueIgnored"}) + private static Consumer serverSpanDataAssertConsumer( + String serverMethod, + String serverClass, + StatusData statusData, + TraceAssert trace, + OpenTelemetryAssertions.StringAssertConsumer errorMsgAssertion, + String errorType) { + Consumer consumer = + span -> + span.hasName(serverMethod) + .hasKind(SpanKind.SERVER) + .hasParent(trace.getSpan(1)) + .hasStatus(statusData) + .hasAttributesSatisfying( + equalTo(AttributeKey.stringKey("net.sock.peer.addr"), "127.0.0.1"), + equalTo(SemanticAttributes.RPC_SYSTEM, "thrift"), + equalTo(SemanticAttributes.RPC_SERVICE, serverClass), + equalTo(SemanticAttributes.RPC_METHOD, serverMethod)); + if (statusData == StatusData.error()) { + consumer = + consumer.andThen( + span -> + span.hasEventsSatisfyingExactly( + event -> + event + .hasName(SemanticAttributes.EXCEPTION_EVENT_NAME) + .hasAttributesSatisfyingExactly( + satisfies( + SemanticAttributes.EXCEPTION_MESSAGE, errorMsgAssertion), + satisfies( + AttributeKey.stringKey("exception.stacktrace"), + AbstractAssert::isNotNull), + equalTo(SemanticAttributes.EXCEPTION_TYPE, errorType)))); + } + return consumer; + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/WithDelayTest.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/WithDelayTest.java new file mode 100644 index 000000000000..a4a36b85e88e --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/WithDelayTest.java @@ -0,0 +1,442 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0; + +import com.google.common.base.VerifyException; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class WithDelayTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + this.syncClientWithDelay(port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", 1); + } + + @Test + public void syncClientSyncSimpleServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithDelay(port, 2); + } + this.waitAndAssertTracesClientSyncServerSync("withDelay", 5); + } + + @Test + public void syncClientSyncSimpleServerSayHelloParallel() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithDelay(port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withDelay", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerSayHello() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientWithDelay(port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", 1); + } + + @Test + public void syncClientSyncThreadPoolServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithDelay(port, 2); + } + this.waitAndAssertTracesClientSyncServerSync("withDelay", 5); + } + + @Test + public void syncClientSyncThreadPoolServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithDelay(port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withDelay", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncFramedClientWithDelay(port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithDelay(port, 2); + } + + this.waitAndAssertTracesClientSyncServerSync("withDelay", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithDelay(port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withDelay", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncFramedClientWithDelay(port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithDelay(port, 2); + } + + this.waitAndAssertTracesClientSyncServerSync("withDelay", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithDelay(port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withDelay", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHello() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.nonBlockClientWithDelay(port, 2); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHelloMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithDelay(port, 1); + } + + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithDelay(port, 1); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHello() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.nonBlockClientWithDelay(port, 2); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHelloMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithDelay(port, 2); + } + + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithDelay(port, 2); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", threadCount); + } + + @Test + public void syncClientSyncNonblockingServerSayHelloError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncClientWithDelay(port, 2); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withDelay", 1); + } + + @Test + public void syncClientSyncHsHaServerSayHelloError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncClientWithDelay(port, 2); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withDelay", 1); + } + + public void syncClientWithDelay(int port, int delay) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.withDelay(delay)); + Assertions.assertThat(response).isEqualTo("delay " + delay); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientWithDelay(int port, int delay) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.withDelay_call s) { + try { + String result = s.getResult(); + Assertions.assertThat(result).isEqualTo("delay " + delay); + } catch (TException e) { + throw new VerifyException(e); + } + } + + @Override + public void onError(Exception e) { + throw new VerifyException("nonBlockClientWithDelay test failed", e); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.withDelay(delay, callback)); + } + + public void syncFramedClientWithDelay(int port, int delay) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.withDelay(delay)); + Assertions.assertThat(response).isEqualTo("delay " + delay); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientWithDelay(int port, int delay) throws IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withDelay(delay)); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/WithErrorTest.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/WithErrorTest.java new file mode 100644 index 000000000000..f6f71b0617f1 --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/WithErrorTest.java @@ -0,0 +1,457 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0; + +import io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class WithErrorTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerWithError() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + this.syncClientWithError(port); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 1); + } + + @Test + public void syncClientSyncSimpleServerWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithError(port); + } + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 5); + } + + @Test + public void syncClientSyncSimpleServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerWithError() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientWithError(port); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 1); + } + + @Test + public void syncClientSyncThreadPoolServerWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithError(port); + } + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 5); + } + + @Test + public void syncClientSyncThreadPoolServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithError() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncFramedClientWithError(port); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithError(port); + } + + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerWithError() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncFramedClientWithError(port); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithError(port); + } + + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithError() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.nonBlockClientWithError(port); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithErrorMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithError(port); + } + + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithError(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerWithError() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.nonBlockClientWithError(port); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerWithErrorMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithError(port); + } + + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithError(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncClientSyncNonblockingServerWithErrorError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncClientWithError(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServer("withError", 1); + } + + @Test + public void syncClientSyncHsHaServerWithErrorError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncClientWithError(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServer("withError", 1); + } + + public void syncClientWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientWithError(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.withError_call s) { + Exception error = null; + try { + String result = s.getResult(); + Assertions.assertThat(result).isEqualTo("Hello USs' Bob"); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + } + + @Override + public void onError(Exception e) { + Assertions.assertThat(e.getCause().getMessage()) + .isEqualTo("Read call frame size failed"); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.withError(callback)); + } + + public void syncFramedClientWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientWithError(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/WithStructTest.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/WithStructTest.java new file mode 100644 index 000000000000..271dee97cd32 --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/WithStructTest.java @@ -0,0 +1,455 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0; + +import com.google.common.base.VerifyException; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.thrift.Account; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.thrift.ThriftService; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.thrift.User; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.thrift.UserAccount; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class WithStructTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerWithStruct() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + this.syncClientWithStruct(port); + this.waitAndAssertTracesClientSyncServerSync("data", 1); + } + + @Test + public void syncClientSyncSimpleServerWithStructMuti() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithStruct(port); + } + this.waitAndAssertTracesClientSyncServerSync("data", 5); + } + + @Test + public void syncClientSyncSimpleServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithStruct(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerWithStruct() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientWithStruct(port); + this.waitAndAssertTracesClientSyncServerSync("data", 1); + } + + @Test + public void syncClientSyncThreadPoolServerWithStructMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithStruct(port); + } + this.waitAndAssertTracesClientSyncServerSync("data", 5); + } + + @Test + public void syncClientSyncThreadPoolServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithStruct(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithStruct() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncFramedClientWithStruct(port); + this.waitAndAssertTracesClientSyncServerSync("data", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithStructMuti() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithStruct(port); + } + + this.waitAndAssertTracesClientSyncServerSync("data", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithStruct(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerWithStruct() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncFramedClientWithStruct(port); + this.waitAndAssertTracesClientSyncServerSync("data", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerWithStructMuti() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithStruct(port); + } + + this.waitAndAssertTracesClientSyncServerSync("data", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithStruct(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithStruct() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.nonBlockClientWithStruct(port); + this.waitAndAssertTracesClientAsyncServerSync("data", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithStructMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithStruct(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("data", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithStruct(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("data", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerWithStruct() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.nonBlockClientWithStruct(port); + this.waitAndAssertTracesClientAsyncServerSync("data", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerWithStructMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithStruct(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("data", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithStruct(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("data", threadCount); + } + + @Test + public void syncClientSyncNonblockingServerWithStructError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncClientWithStruct(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("data", 1); + } + + @Test + public void syncClientSyncHsHaServerWithStructError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncClientWithStruct(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("data", 1); + } + + public void syncClientWithStruct(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + UserAccount response = this.testing().runWithSpan("parent", () -> client.data(user, account)); + Assertions.assertThat(response.user).isEqualTo(user); + Assertions.assertThat(response.account).isEqualTo(account); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientWithStruct(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.data_call response) { + try { + UserAccount result = response.getResult(); + Assertions.assertThat(result.user).isEqualTo(user); + Assertions.assertThat(result.account).isEqualTo(account); + } catch (TException e) { + throw new VerifyException(e); + } + } + + @Override + public void onError(Exception e) { + throw new VerifyException("asyncClientWithStruct test failed", e); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.data(user, account, callback)); + } + + public void syncFramedClientWithStruct(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + UserAccount response = this.testing().runWithSpan("parent", () -> client.data(user, account)); + Assertions.assertThat(response.user).isEqualTo(user); + Assertions.assertThat(response.account).isEqualTo(account); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientWithStruct(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + UserAccount response = this.testing().runWithSpan("parent", () -> client.data(user, account)); + Assertions.assertThat(response.user).isEqualTo(user); + Assertions.assertThat(response.account).isEqualTo(account); + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/WithoutArgsTest.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/WithoutArgsTest.java new file mode 100644 index 000000000000..7833ca9f8212 --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/WithoutArgsTest.java @@ -0,0 +1,445 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0; + +import com.google.common.base.VerifyException; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class WithoutArgsTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerWithoutArgs() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + this.syncClientWithoutArgs(port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 1); + } + + @Test + public void syncClientSyncSimpleServerWithoutArgsMuti() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithoutArgs(port); + } + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 5); + } + + @Test + public void syncClientSyncSimpleServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithoutArgs(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerWithoutArgs() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientWithoutArgs(port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 1); + } + + @Test + public void syncClientSyncThreadPoolServerWithoutArgsMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithoutArgs(port); + } + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 5); + } + + @Test + public void syncClientSyncThreadPoolServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithoutArgs(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithoutArgs() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncFramedClientWithoutArgs(port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithoutArgsMuti() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithoutArgs(port); + } + + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithoutArgs(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerWithoutArgs() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncFramedClientWithoutArgs(port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerWithoutArgsMuti() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithoutArgs(port); + } + + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithoutArgs(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithoutArgs() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.nonBlockClientWithoutArgs(port); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithoutArgsMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithoutArgs(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithoutArgs(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerWithoutArgs() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.nonBlockClientWithoutArgs(port); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerWithoutArgsMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithoutArgs(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithoutArgs(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncClientSyncNonblockingServerWithoutArgsError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncClientWithoutArgs(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withoutArgs", 1); + } + + @Test + public void syncClientSyncHsHaServerWithoutArgsError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncClientWithoutArgs(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withoutArgs", 1); + } + + public void syncClientWithoutArgs(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.withoutArgs()); + Assertions.assertThat(response).isEqualTo("no args"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientWithoutArgs(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.withoutArgs_call s) { + try { + String result = s.getResult(); + Assertions.assertThat(result).isEqualTo("no args"); + } catch (TException e) { + throw new VerifyException(e); + } + } + + @Override + public void onError(Exception e) { + throw new VerifyException("asyncClientWithoutArgs test failed", e); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.withoutArgs(callback)); + } + + public void syncFramedClientWithoutArgs(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.withoutArgs()); + Assertions.assertThat(response).isEqualTo("no args"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientWithoutArgs(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withoutArgs()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/server/ThriftServiceAsyncImpl.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/server/ThriftServiceAsyncImpl.java new file mode 100644 index 000000000000..8d1d4345f04b --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/server/ThriftServiceAsyncImpl.java @@ -0,0 +1,77 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.server; + +import com.google.common.base.VerifyException; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.thrift.Account; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.thrift.ThriftService; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.thrift.User; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.thrift.UserAccount; +import java.util.concurrent.TimeUnit; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused", "all"}) +public class ThriftServiceAsyncImpl implements ThriftService.AsyncIface { + public ThriftServiceAsyncImpl() {} + + @Override + public void sayHello(String zone, String name, AsyncMethodCallback resultHandler) + throws TException { + resultHandler.onComplete("Hello " + zone + "s' " + name); + } + + @Override + public void withDelay(int delay, AsyncMethodCallback resultHandler) throws TException { + try { + TimeUnit.SECONDS.sleep(delay); + } catch (InterruptedException var4) { + InterruptedException e = var4; + throw new VerifyException(e); + } + + resultHandler.onComplete("delay " + delay); + } + + @Override + public void withoutArgs(AsyncMethodCallback resultHandler) throws TException { + resultHandler.onComplete("no args"); + } + + @Override + public void withError(AsyncMethodCallback resultHandler) throws TException { + throw new VerifyException("fail"); + } + + @Override + public void withCollisioin(String input, AsyncMethodCallback resultHandler) throws TException { + resultHandler.onComplete(input); + } + + @Override + public void oneWayHasArgs(int delay, AsyncMethodCallback resultHandler) throws TException {} + + @Override + public void oneWay(AsyncMethodCallback resultHandler) throws TException {} + + @Override + public void oneWayWithError(AsyncMethodCallback resultHandler) throws TException { + throw new VerifyException("fail"); + } + + @Override + public void data(User user, Account account, AsyncMethodCallback resultHandler) + throws TException { + resultHandler.onComplete(new UserAccount(user, account)); + } + + @Override + public void noReturn( + int delay, AsyncMethodCallback resultHandler) + throws TException { + resultHandler.onComplete(null); + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/server/ThriftServiceImpl.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/server/ThriftServiceImpl.java new file mode 100644 index 000000000000..e88b14fa537e --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/server/ThriftServiceImpl.java @@ -0,0 +1,71 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.server; + +import com.google.common.base.VerifyException; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.thrift.Account; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.thrift.ThriftService; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.thrift.User; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.thrift.UserAccount; +import java.util.concurrent.TimeUnit; +import org.apache.thrift.TException; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused", "all"}) +public class ThriftServiceImpl implements ThriftService.Iface { + + public ThriftServiceImpl() {} + + @Override + public String sayHello(String zone, String name) { + return "Hello " + zone + "s' " + name; + } + + @Override + public String withDelay(int delay) { + try { + TimeUnit.SECONDS.sleep((long) delay); + } catch (InterruptedException var3) { + InterruptedException e = var3; + throw new VerifyException(e); + } + + return "delay " + delay; + } + + @Override + public String withoutArgs() { + return "no args"; + } + + @Override + public String withError() { + throw new VerifyException("fail"); + } + + @Override + public String withCollisioin(String input) { + return input; + } + + @Override + public void noReturn(int delay) throws TException {} + + @Override + public void oneWayHasArgs(int delay) throws TException {} + + @Override + public void oneWay() {} + + @Override + public void oneWayWithError() { + throw new VerifyException("fail"); + } + + @Override + public UserAccount data(User user, Account account) { + return new UserAccount(user, account); + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/thrift/Account.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/thrift/Account.java new file mode 100644 index 000000000000..1164322b8cda --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/thrift/Account.java @@ -0,0 +1,414 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.thrift; + +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "all"}) +public class Account + implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("Account"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField CARD_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "cardId", org.apache.thrift.protocol.TType.STRING, (short) 2); + + public String zone; // required + public String cardId; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + CARD_ID((short) 2, "cardId"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // CARD_ID + return CARD_ID; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.CARD_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "cardId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Account.class, metaDataMap); + } + + public Account() {} + + public Account(String zone, String cardId) { + this(); + this.zone = zone; + this.cardId = cardId; + } + + /** Performs a deep copy on other. */ + public Account(Account other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetCardId()) { + this.cardId = other.cardId; + } + } + + public Account deepCopy() { + return new Account(this); + } + + @Override + public void clear() { + this.zone = null; + this.cardId = null; + } + + public String getZone() { + return this.zone; + } + + public Account setZone(String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + public String getCardId() { + return this.cardId; + } + + public Account setCardId(String cardId) { + this.cardId = cardId; + return this; + } + + public void unsetCardId() { + this.cardId = null; + } + + /** Returns true if field cardId is set (has been assigned a value) and false otherwise */ + public boolean isSetCardId() { + return this.cardId != null; + } + + public void setCardIdIsSet(boolean value) { + if (!value) { + this.cardId = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((String) value); + } + break; + + case CARD_ID: + if (value == null) { + unsetCardId(); + } else { + setCardId((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case CARD_ID: + return getCardId(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case CARD_ID: + return isSetCardId(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof Account) return this.equals((Account) that); + return false; + } + + public boolean equals(Account that) { + if (that == null) return false; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_cardId = true && this.isSetCardId(); + boolean that_present_cardId = true && that.isSetCardId(); + if (this_present_cardId || that_present_cardId) { + if (!(this_present_cardId && that_present_cardId)) return false; + if (!this.cardId.equals(that.cardId)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(Account other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + Account typedOther = (Account) other; + + lastComparison = Boolean.valueOf(isSetZone()).compareTo(typedOther.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, typedOther.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetCardId()).compareTo(typedOther.isSetCardId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCardId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cardId, typedOther.cardId); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + case 1: // ZONE + if (field.type == org.apache.thrift.protocol.TType.STRING) { + this.zone = iprot.readString(); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + case 2: // CARD_ID + if (field.type == org.apache.thrift.protocol.TType.STRING) { + this.cardId = iprot.readString(); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (this.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(this.zone); + oprot.writeFieldEnd(); + } + if (this.cardId != null) { + oprot.writeFieldBegin(CARD_ID_FIELD_DESC); + oprot.writeString(this.cardId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("Account("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("cardId:"); + if (this.cardId == null) { + sb.append("null"); + } else { + sb.append(this.cardId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (zone == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'zone' was not present! Struct: " + toString()); + } + if (cardId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'cardId' was not present! Struct: " + toString()); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/thrift/ThriftService.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/thrift/ThriftService.java new file mode 100644 index 000000000000..bd92bd05d931 --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/thrift/ThriftService.java @@ -0,0 +1,5885 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.thrift; + +import java.util.BitSet; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "all"}) +public class ThriftService { + + public interface Iface { + + public String sayHello(String zone, String name) throws org.apache.thrift.TException; + + public String withDelay(int delay) throws org.apache.thrift.TException; + + public String withoutArgs() throws org.apache.thrift.TException; + + public String withError() throws org.apache.thrift.TException; + + public String withCollisioin(String input) throws org.apache.thrift.TException; + + public void noReturn(int delay) throws org.apache.thrift.TException; + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException; + + public void oneWay() throws org.apache.thrift.TException; + + public void oneWayWithError() throws org.apache.thrift.TException; + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException; + } + + public interface AsyncIface { + + public void sayHello( + String zone, + String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withDelay( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withCollisioin( + String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void noReturn( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayHasArgs( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWay( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayWithError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + } + + public static class Client extends org.apache.thrift.TServiceClient implements Iface { + public static class Factory implements org.apache.thrift.TServiceClientFactory { + public Factory() {} + + public Client getClient(org.apache.thrift.protocol.TProtocol prot) { + return new Client(prot); + } + + public Client getClient( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + return new Client(iprot, oprot); + } + } + + public Client(org.apache.thrift.protocol.TProtocol prot) { + super(prot, prot); + } + + public Client( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + super(iprot, oprot); + } + + public String sayHello(String zone, String name) throws org.apache.thrift.TException { + send_sayHello(zone, name); + return recv_sayHello(); + } + + public void send_sayHello(String zone, String name) throws org.apache.thrift.TException { + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + sendBase("sayHello", args); + } + + public String recv_sayHello() throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + receiveBase(result, "sayHello"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "sayHello failed: unknown result"); + } + + public String withDelay(int delay) throws org.apache.thrift.TException { + send_withDelay(delay); + return recv_withDelay(); + } + + public void send_withDelay(int delay) throws org.apache.thrift.TException { + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + sendBase("withDelay", args); + } + + public String recv_withDelay() throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + receiveBase(result, "withDelay"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withDelay failed: unknown result"); + } + + public String withoutArgs() throws org.apache.thrift.TException { + send_withoutArgs(); + return recv_withoutArgs(); + } + + public void send_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_args args = new withoutArgs_args(); + sendBase("withoutArgs", args); + } + + public String recv_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + receiveBase(result, "withoutArgs"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withoutArgs failed: unknown result"); + } + + public String withError() throws org.apache.thrift.TException { + send_withError(); + return recv_withError(); + } + + public void send_withError() throws org.apache.thrift.TException { + withError_args args = new withError_args(); + sendBase("withError", args); + } + + public String recv_withError() throws org.apache.thrift.TException { + withError_result result = new withError_result(); + receiveBase(result, "withError"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withError failed: unknown result"); + } + + public String withCollisioin(String input) throws org.apache.thrift.TException { + send_withCollisioin(input); + return recv_withCollisioin(); + } + + public void send_withCollisioin(String input) throws org.apache.thrift.TException { + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + sendBase("withCollisioin", args); + } + + public String recv_withCollisioin() throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + receiveBase(result, "withCollisioin"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withCollisioin failed: unknown result"); + } + + public void noReturn(int delay) throws org.apache.thrift.TException { + send_noReturn(delay); + recv_noReturn(); + } + + public void send_noReturn(int delay) throws org.apache.thrift.TException { + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + sendBase("noReturn", args); + } + + public void recv_noReturn() throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + receiveBase(result, "noReturn"); + return; + } + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException { + send_oneWayHasArgs(delay); + } + + public void send_oneWayHasArgs(int delay) throws org.apache.thrift.TException { + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + sendBase("oneWayHasArgs", args); + } + + public void oneWay() throws org.apache.thrift.TException { + send_oneWay(); + } + + public void send_oneWay() throws org.apache.thrift.TException { + oneWay_args args = new oneWay_args(); + sendBase("oneWay", args); + } + + public void oneWayWithError() throws org.apache.thrift.TException { + send_oneWayWithError(); + } + + public void send_oneWayWithError() throws org.apache.thrift.TException { + oneWayWithError_args args = new oneWayWithError_args(); + sendBase("oneWayWithError", args); + } + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException { + send_data(user, account); + return recv_data(); + } + + public void send_data(User user, Account account) throws org.apache.thrift.TException { + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + sendBase("data", args); + } + + public UserAccount recv_data() throws org.apache.thrift.TException { + data_result result = new data_result(); + receiveBase(result, "data"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, "data failed: unknown result"); + } + } + + public static class AsyncClient extends org.apache.thrift.async.TAsyncClient + implements AsyncIface { + public static class Factory + implements org.apache.thrift.async.TAsyncClientFactory { + private org.apache.thrift.async.TAsyncClientManager clientManager; + private org.apache.thrift.protocol.TProtocolFactory protocolFactory; + + public Factory( + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.protocol.TProtocolFactory protocolFactory) { + this.clientManager = clientManager; + this.protocolFactory = protocolFactory; + } + + public AsyncClient getAsyncClient( + org.apache.thrift.transport.TNonblockingTransport transport) { + return new AsyncClient(protocolFactory, clientManager, transport); + } + } + + public AsyncClient( + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.transport.TNonblockingTransport transport) { + super(protocolFactory, clientManager, transport); + } + + public void sayHello( + String zone, + String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + sayHello_call method_call = + new sayHello_call(zone, name, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class sayHello_call extends org.apache.thrift.async.TAsyncMethodCall { + private String zone; + private String name; + + public sayHello_call( + String zone, + String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.zone = zone; + this.name = name; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "sayHello", org.apache.thrift.protocol.TMessageType.CALL, 0)); + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_sayHello(); + } + } + + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withDelay_call method_call = + new withDelay_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withDelay_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public withDelay_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withDelay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withDelay(); + } + } + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withoutArgs_call method_call = + new withoutArgs_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withoutArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + public withoutArgs_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withoutArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withoutArgs_args args = new withoutArgs_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withoutArgs(); + } + } + + public void withError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withError_call method_call = + new withError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withError_call extends org.apache.thrift.async.TAsyncMethodCall { + public withError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withError_args args = new withError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withError(); + } + } + + public void withCollisioin( + String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withCollisioin_call method_call = + new withCollisioin_call(input, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withCollisioin_call extends org.apache.thrift.async.TAsyncMethodCall { + private String input; + + public withCollisioin_call( + String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.input = input; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withCollisioin", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withCollisioin(); + } + } + + public void noReturn( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + noReturn_call method_call = + new noReturn_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class noReturn_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public noReturn_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "noReturn", org.apache.thrift.protocol.TMessageType.CALL, 0)); + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws org.apache.thrift.TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + (new Client(prot)).recv_noReturn(); + } + } + + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayHasArgs_call method_call = + new oneWayHasArgs_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayHasArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public oneWayHasArgs_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayHasArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws org.apache.thrift.TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWay_call method_call = + new oneWay_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWay_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWay_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + oneWay_args args = new oneWay_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws org.apache.thrift.TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void oneWayWithError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayWithError_call method_call = + new oneWayWithError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayWithError_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWayWithError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayWithError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + oneWayWithError_args args = new oneWayWithError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws org.apache.thrift.TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + data_call method_call = + new data_call(user, account, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class data_call extends org.apache.thrift.async.TAsyncMethodCall { + private User user; + private Account account; + + public data_call( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.user = user; + this.account = account; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "data", org.apache.thrift.protocol.TMessageType.CALL, 0)); + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + args.write(prot); + prot.writeMessageEnd(); + } + + public UserAccount getResult() throws org.apache.thrift.TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_data(); + } + } + } + + public static class Processor extends org.apache.thrift.TBaseProcessor + implements org.apache.thrift.TProcessor { + private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); + + public Processor(I iface) { + super( + iface, + getProcessMap( + new HashMap< + String, + org.apache.thrift.ProcessFunction>())); + } + + protected Processor( + I iface, + Map> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + Map> + getProcessMap( + Map> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + private static class sayHello + extends org.apache.thrift.ProcessFunction { + public sayHello() { + super("sayHello"); + } + + protected sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + protected sayHello_result getResult(I iface, sayHello_args args) + throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + result.success = iface.sayHello(args.zone, args.name); + return result; + } + } + + private static class withDelay + extends org.apache.thrift.ProcessFunction { + public withDelay() { + super("withDelay"); + } + + protected withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + protected withDelay_result getResult(I iface, withDelay_args args) + throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + result.success = iface.withDelay(args.delay); + return result; + } + } + + private static class withoutArgs + extends org.apache.thrift.ProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + protected withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + protected withoutArgs_result getResult(I iface, withoutArgs_args args) + throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + result.success = iface.withoutArgs(); + return result; + } + } + + private static class withError + extends org.apache.thrift.ProcessFunction { + public withError() { + super("withError"); + } + + protected withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + protected withError_result getResult(I iface, withError_args args) + throws org.apache.thrift.TException { + withError_result result = new withError_result(); + result.success = iface.withError(); + return result; + } + } + + private static class withCollisioin + extends org.apache.thrift.ProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + protected withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + protected withCollisioin_result getResult(I iface, withCollisioin_args args) + throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + result.success = iface.withCollisioin(args.input); + return result; + } + } + + private static class noReturn + extends org.apache.thrift.ProcessFunction { + public noReturn() { + super("noReturn"); + } + + protected noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + protected noReturn_result getResult(I iface, noReturn_args args) + throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + iface.noReturn(args.delay); + return result; + } + } + + private static class oneWayHasArgs + extends org.apache.thrift.ProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + protected oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + protected org.apache.thrift.TBase getResult(I iface, oneWayHasArgs_args args) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay); + return null; + } + } + + private static class oneWay + extends org.apache.thrift.ProcessFunction { + public oneWay() { + super("oneWay"); + } + + protected oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + protected org.apache.thrift.TBase getResult(I iface, oneWay_args args) + throws org.apache.thrift.TException { + iface.oneWay(); + return null; + } + } + + private static class oneWayWithError + extends org.apache.thrift.ProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + protected oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + protected org.apache.thrift.TBase getResult(I iface, oneWayWithError_args args) + throws org.apache.thrift.TException { + iface.oneWayWithError(); + return null; + } + } + + private static class data + extends org.apache.thrift.ProcessFunction { + public data() { + super("data"); + } + + protected data_args getEmptyArgsInstance() { + return new data_args(); + } + + protected data_result getResult(I iface, data_args args) throws org.apache.thrift.TException { + data_result result = new data_result(); + result.success = iface.data(args.user, args.account); + return result; + } + } + } + + public static class sayHello_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_args"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 2); + + public String zone; // required + public String name; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + NAME((short) 2, "name"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // NAME + return NAME; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_args.class, metaDataMap); + } + + public sayHello_args() {} + + public sayHello_args(String zone, String name) { + this(); + this.zone = zone; + this.name = name; + } + + /** Performs a deep copy on other. */ + public sayHello_args(sayHello_args other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetName()) { + this.name = other.name; + } + } + + public sayHello_args deepCopy() { + return new sayHello_args(this); + } + + @Override + public void clear() { + this.zone = null; + this.name = null; + } + + public String getZone() { + return this.zone; + } + + public sayHello_args setZone(String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + public String getName() { + return this.name; + } + + public sayHello_args setName(String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((String) value); + } + break; + + case NAME: + if (value == null) { + unsetName(); + } else { + setName((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case NAME: + return getName(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case NAME: + return isSetName(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof sayHello_args) return this.equals((sayHello_args) that); + return false; + } + + public boolean equals(sayHello_args that) { + if (that == null) return false; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(sayHello_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + sayHello_args typedOther = (sayHello_args) other; + + lastComparison = Boolean.valueOf(isSetZone()).compareTo(typedOther.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, typedOther.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetName()).compareTo(typedOther.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, typedOther.name); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + case 1: // ZONE + if (field.type == org.apache.thrift.protocol.TType.STRING) { + this.zone = iprot.readString(); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + case 2: // NAME + if (field.type == org.apache.thrift.protocol.TType.STRING) { + this.name = iprot.readString(); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (this.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(this.zone); + oprot.writeFieldEnd(); + } + if (this.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(this.name); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("sayHello_args("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class sayHello_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_result.class, metaDataMap); + } + + public sayHello_result() {} + + public sayHello_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public sayHello_result(sayHello_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public sayHello_result deepCopy() { + return new sayHello_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public sayHello_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof sayHello_result) return this.equals((sayHello_result) that); + return false; + } + + public boolean equals(sayHello_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(sayHello_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + sayHello_result typedOther = (sayHello_result) other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + case 0: // SUCCESS + if (field.type == org.apache.thrift.protocol.TType.STRING) { + this.success = iprot.readString(); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + oprot.writeStructBegin(STRUCT_DESC); + + if (this.isSetSuccess()) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(this.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("sayHello_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class withDelay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private BitSet __isset_bit_vector = new BitSet(1); + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_args.class, metaDataMap); + } + + public withDelay_args() {} + + public withDelay_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public withDelay_args(withDelay_args other) { + __isset_bit_vector.clear(); + __isset_bit_vector.or(other.__isset_bit_vector); + this.delay = other.delay; + } + + public withDelay_args deepCopy() { + return new withDelay_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public withDelay_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bit_vector.clear(__DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return __isset_bit_vector.get(__DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bit_vector.set(__DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return Integer.valueOf(getDelay()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withDelay_args) return this.equals((withDelay_args) that); + return false; + } + + public boolean equals(withDelay_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withDelay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withDelay_args typedOther = (withDelay_args) other; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(typedOther.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, typedOther.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + case 1: // DELAY + if (field.type == org.apache.thrift.protocol.TType.I32) { + this.delay = iprot.readI32(); + setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(this.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withDelay_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bit_vector = new BitSet(1); + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class withDelay_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_result.class, metaDataMap); + } + + public withDelay_result() {} + + public withDelay_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withDelay_result(withDelay_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withDelay_result deepCopy() { + return new withDelay_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withDelay_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withDelay_result) return this.equals((withDelay_result) that); + return false; + } + + public boolean equals(withDelay_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withDelay_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withDelay_result typedOther = (withDelay_result) other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + case 0: // SUCCESS + if (field.type == org.apache.thrift.protocol.TType.STRING) { + this.success = iprot.readString(); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + oprot.writeStructBegin(STRUCT_DESC); + + if (this.isSetSuccess()) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(this.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withDelay_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class withoutArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_args"); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_args.class, metaDataMap); + } + + public withoutArgs_args() {} + + /** Performs a deep copy on other. */ + public withoutArgs_args(withoutArgs_args other) {} + + public withoutArgs_args deepCopy() { + return new withoutArgs_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withoutArgs_args) return this.equals((withoutArgs_args) that); + return false; + } + + public boolean equals(withoutArgs_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withoutArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withoutArgs_args typedOther = (withoutArgs_args) other; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withoutArgs_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class withoutArgs_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_result.class, metaDataMap); + } + + public withoutArgs_result() {} + + public withoutArgs_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withoutArgs_result(withoutArgs_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withoutArgs_result deepCopy() { + return new withoutArgs_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withoutArgs_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withoutArgs_result) return this.equals((withoutArgs_result) that); + return false; + } + + public boolean equals(withoutArgs_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withoutArgs_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withoutArgs_result typedOther = (withoutArgs_result) other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + case 0: // SUCCESS + if (field.type == org.apache.thrift.protocol.TType.STRING) { + this.success = iprot.readString(); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + oprot.writeStructBegin(STRUCT_DESC); + + if (this.isSetSuccess()) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(this.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withoutArgs_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class withError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_args"); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_args.class, metaDataMap); + } + + public withError_args() {} + + /** Performs a deep copy on other. */ + public withError_args(withError_args other) {} + + public withError_args deepCopy() { + return new withError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withError_args) return this.equals((withError_args) that); + return false; + } + + public boolean equals(withError_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withError_args typedOther = (withError_args) other; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class withError_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_result.class, metaDataMap); + } + + public withError_result() {} + + public withError_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withError_result(withError_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withError_result deepCopy() { + return new withError_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withError_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withError_result) return this.equals((withError_result) that); + return false; + } + + public boolean equals(withError_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withError_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withError_result typedOther = (withError_result) other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + case 0: // SUCCESS + if (field.type == org.apache.thrift.protocol.TType.STRING) { + this.success = iprot.readString(); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + oprot.writeStructBegin(STRUCT_DESC); + + if (this.isSetSuccess()) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(this.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withError_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class withCollisioin_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_args"); + + private static final org.apache.thrift.protocol.TField INPUT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "input", org.apache.thrift.protocol.TType.STRING, (short) 3333); + + public String input; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + INPUT((short) 3333, "input"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 3333: // INPUT + return INPUT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.INPUT, + new org.apache.thrift.meta_data.FieldMetaData( + "input", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_args.class, metaDataMap); + } + + public withCollisioin_args() {} + + public withCollisioin_args(String input) { + this(); + this.input = input; + } + + /** Performs a deep copy on other. */ + public withCollisioin_args(withCollisioin_args other) { + if (other.isSetInput()) { + this.input = other.input; + } + } + + public withCollisioin_args deepCopy() { + return new withCollisioin_args(this); + } + + @Override + public void clear() { + this.input = null; + } + + public String getInput() { + return this.input; + } + + public withCollisioin_args setInput(String input) { + this.input = input; + return this; + } + + public void unsetInput() { + this.input = null; + } + + /** Returns true if field input is set (has been assigned a value) and false otherwise */ + public boolean isSetInput() { + return this.input != null; + } + + public void setInputIsSet(boolean value) { + if (!value) { + this.input = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case INPUT: + if (value == null) { + unsetInput(); + } else { + setInput((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case INPUT: + return getInput(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case INPUT: + return isSetInput(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withCollisioin_args) return this.equals((withCollisioin_args) that); + return false; + } + + public boolean equals(withCollisioin_args that) { + if (that == null) return false; + + boolean this_present_input = true && this.isSetInput(); + boolean that_present_input = true && that.isSetInput(); + if (this_present_input || that_present_input) { + if (!(this_present_input && that_present_input)) return false; + if (!this.input.equals(that.input)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withCollisioin_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withCollisioin_args typedOther = (withCollisioin_args) other; + + lastComparison = Boolean.valueOf(isSetInput()).compareTo(typedOther.isSetInput()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInput()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.input, typedOther.input); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + case 3333: // INPUT + if (field.type == org.apache.thrift.protocol.TType.STRING) { + this.input = iprot.readString(); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (this.input != null) { + oprot.writeFieldBegin(INPUT_FIELD_DESC); + oprot.writeString(this.input); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withCollisioin_args("); + boolean first = true; + + sb.append("input:"); + if (this.input == null) { + sb.append("null"); + } else { + sb.append(this.input); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class withCollisioin_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_result.class, metaDataMap); + } + + public withCollisioin_result() {} + + public withCollisioin_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withCollisioin_result(withCollisioin_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withCollisioin_result deepCopy() { + return new withCollisioin_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withCollisioin_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withCollisioin_result) return this.equals((withCollisioin_result) that); + return false; + } + + public boolean equals(withCollisioin_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withCollisioin_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withCollisioin_result typedOther = (withCollisioin_result) other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + case 0: // SUCCESS + if (field.type == org.apache.thrift.protocol.TType.STRING) { + this.success = iprot.readString(); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + oprot.writeStructBegin(STRUCT_DESC); + + if (this.isSetSuccess()) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(this.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withCollisioin_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class noReturn_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private BitSet __isset_bit_vector = new BitSet(1); + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_args.class, metaDataMap); + } + + public noReturn_args() {} + + public noReturn_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public noReturn_args(noReturn_args other) { + __isset_bit_vector.clear(); + __isset_bit_vector.or(other.__isset_bit_vector); + this.delay = other.delay; + } + + public noReturn_args deepCopy() { + return new noReturn_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public noReturn_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bit_vector.clear(__DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return __isset_bit_vector.get(__DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bit_vector.set(__DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return Integer.valueOf(getDelay()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof noReturn_args) return this.equals((noReturn_args) that); + return false; + } + + public boolean equals(noReturn_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(noReturn_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + noReturn_args typedOther = (noReturn_args) other; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(typedOther.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, typedOther.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + case 1: // DELAY + if (field.type == org.apache.thrift.protocol.TType.I32) { + this.delay = iprot.readI32(); + setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(this.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("noReturn_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bit_vector = new BitSet(1); + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class noReturn_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_result"); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_result.class, metaDataMap); + } + + public noReturn_result() {} + + /** Performs a deep copy on other. */ + public noReturn_result(noReturn_result other) {} + + public noReturn_result deepCopy() { + return new noReturn_result(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof noReturn_result) return this.equals((noReturn_result) that); + return false; + } + + public boolean equals(noReturn_result that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(noReturn_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + noReturn_result typedOther = (noReturn_result) other; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + oprot.writeStructBegin(STRUCT_DESC); + + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("noReturn_result("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class oneWayHasArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayHasArgs_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private BitSet __isset_bit_vector = new BitSet(1); + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayHasArgs_args.class, metaDataMap); + } + + public oneWayHasArgs_args() {} + + public oneWayHasArgs_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public oneWayHasArgs_args(oneWayHasArgs_args other) { + __isset_bit_vector.clear(); + __isset_bit_vector.or(other.__isset_bit_vector); + this.delay = other.delay; + } + + public oneWayHasArgs_args deepCopy() { + return new oneWayHasArgs_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public oneWayHasArgs_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bit_vector.clear(__DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return __isset_bit_vector.get(__DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bit_vector.set(__DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return Integer.valueOf(getDelay()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWayHasArgs_args) return this.equals((oneWayHasArgs_args) that); + return false; + } + + public boolean equals(oneWayHasArgs_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(oneWayHasArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + oneWayHasArgs_args typedOther = (oneWayHasArgs_args) other; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(typedOther.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, typedOther.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + case 1: // DELAY + if (field.type == org.apache.thrift.protocol.TType.I32) { + this.delay = iprot.readI32(); + setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(this.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWayHasArgs_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bit_vector = new BitSet(1); + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class oneWay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWay_args"); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWay_args.class, metaDataMap); + } + + public oneWay_args() {} + + /** Performs a deep copy on other. */ + public oneWay_args(oneWay_args other) {} + + public oneWay_args deepCopy() { + return new oneWay_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWay_args) return this.equals((oneWay_args) that); + return false; + } + + public boolean equals(oneWay_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(oneWay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + oneWay_args typedOther = (oneWay_args) other; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWay_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class oneWayWithError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayWithError_args"); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayWithError_args.class, metaDataMap); + } + + public oneWayWithError_args() {} + + /** Performs a deep copy on other. */ + public oneWayWithError_args(oneWayWithError_args other) {} + + public oneWayWithError_args deepCopy() { + return new oneWayWithError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWayWithError_args) return this.equals((oneWayWithError_args) that); + return false; + } + + public boolean equals(oneWayWithError_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(oneWayWithError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + oneWayWithError_args typedOther = (oneWayWithError_args) other; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWayWithError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class data_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_args"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + public User user; // required + public Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(data_args.class, metaDataMap); + } + + public data_args() {} + + public data_args(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public data_args(data_args other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public data_args deepCopy() { + return new data_args(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + public User getUser() { + return this.user; + } + + public data_args setUser(User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + public Account getAccount() { + return this.account; + } + + public data_args setAccount(Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof data_args) return this.equals((data_args) that); + return false; + } + + public boolean equals(data_args that) { + if (that == null) return false; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(data_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + data_args typedOther = (data_args) other; + + lastComparison = Boolean.valueOf(isSetUser()).compareTo(typedOther.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, typedOther.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAccount()).compareTo(typedOther.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, typedOther.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + case 1: // USER + if (field.type == org.apache.thrift.protocol.TType.STRUCT) { + this.user = new User(); + this.user.read(iprot); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + case 2: // ACCOUNT + if (field.type == org.apache.thrift.protocol.TType.STRUCT) { + this.account = new Account(); + this.account.read(iprot); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (this.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + this.user.write(oprot); + oprot.writeFieldEnd(); + } + if (this.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + this.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("data_args("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class data_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRUCT, (short) 0); + + public UserAccount success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, UserAccount.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + data_result.class, metaDataMap); + } + + public data_result() {} + + public data_result(UserAccount success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public data_result(data_result other) { + if (other.isSetSuccess()) { + this.success = new UserAccount(other.success); + } + } + + public data_result deepCopy() { + return new data_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public UserAccount getSuccess() { + return this.success; + } + + public data_result setSuccess(UserAccount success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((UserAccount) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof data_result) return this.equals((data_result) that); + return false; + } + + public boolean equals(data_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(data_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + data_result typedOther = (data_result) other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + case 0: // SUCCESS + if (field.type == org.apache.thrift.protocol.TType.STRUCT) { + this.success = new UserAccount(); + this.success.read(iprot); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + oprot.writeStructBegin(STRUCT_DESC); + + if (this.isSetSuccess()) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + this.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("data_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/thrift/User.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/thrift/User.java new file mode 100644 index 000000000000..7ece17189cb4 --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/thrift/User.java @@ -0,0 +1,513 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.thrift; + +import java.util.BitSet; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "all"}) +public class User + implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("User"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "userId", org.apache.thrift.protocol.TType.STRING, (short) 2); + private static final org.apache.thrift.protocol.TField AGE_FIELD_DESC = + new org.apache.thrift.protocol.TField("age", org.apache.thrift.protocol.TType.I32, (short) 3); + + public String name; // required + public String userId; // required + public int age; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + NAME((short) 1, "name"), + USER_ID((short) 2, "userId"), + AGE((short) 3, "age"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // NAME + return NAME; + case 2: // USER_ID + return USER_ID; + case 3: // AGE + return AGE; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __AGE_ISSET_ID = 0; + private BitSet __isset_bit_vector = new BitSet(1); + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.USER_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "userId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.AGE, + new org.apache.thrift.meta_data.FieldMetaData( + "age", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(User.class, metaDataMap); + } + + public User() {} + + public User(String name, String userId, int age) { + this(); + this.name = name; + this.userId = userId; + this.age = age; + setAgeIsSet(true); + } + + /** Performs a deep copy on other. */ + public User(User other) { + __isset_bit_vector.clear(); + __isset_bit_vector.or(other.__isset_bit_vector); + if (other.isSetName()) { + this.name = other.name; + } + if (other.isSetUserId()) { + this.userId = other.userId; + } + this.age = other.age; + } + + public User deepCopy() { + return new User(this); + } + + @Override + public void clear() { + this.name = null; + this.userId = null; + setAgeIsSet(false); + this.age = 0; + } + + public String getName() { + return this.name; + } + + public User setName(String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public String getUserId() { + return this.userId; + } + + public User setUserId(String userId) { + this.userId = userId; + return this; + } + + public void unsetUserId() { + this.userId = null; + } + + /** Returns true if field userId is set (has been assigned a value) and false otherwise */ + public boolean isSetUserId() { + return this.userId != null; + } + + public void setUserIdIsSet(boolean value) { + if (!value) { + this.userId = null; + } + } + + public int getAge() { + return this.age; + } + + public User setAge(int age) { + this.age = age; + setAgeIsSet(true); + return this; + } + + public void unsetAge() { + __isset_bit_vector.clear(__AGE_ISSET_ID); + } + + /** Returns true if field age is set (has been assigned a value) and false otherwise */ + public boolean isSetAge() { + return __isset_bit_vector.get(__AGE_ISSET_ID); + } + + public void setAgeIsSet(boolean value) { + __isset_bit_vector.set(__AGE_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case NAME: + if (value == null) { + unsetName(); + } else { + setName((String) value); + } + break; + + case USER_ID: + if (value == null) { + unsetUserId(); + } else { + setUserId((String) value); + } + break; + + case AGE: + if (value == null) { + unsetAge(); + } else { + setAge((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case NAME: + return getName(); + + case USER_ID: + return getUserId(); + + case AGE: + return Integer.valueOf(getAge()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case NAME: + return isSetName(); + case USER_ID: + return isSetUserId(); + case AGE: + return isSetAge(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof User) return this.equals((User) that); + return false; + } + + public boolean equals(User that) { + if (that == null) return false; + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + boolean this_present_userId = true && this.isSetUserId(); + boolean that_present_userId = true && that.isSetUserId(); + if (this_present_userId || that_present_userId) { + if (!(this_present_userId && that_present_userId)) return false; + if (!this.userId.equals(that.userId)) return false; + } + + boolean this_present_age = true; + boolean that_present_age = true; + if (this_present_age || that_present_age) { + if (!(this_present_age && that_present_age)) return false; + if (this.age != that.age) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(User other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + User typedOther = (User) other; + + lastComparison = Boolean.valueOf(isSetName()).compareTo(typedOther.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, typedOther.name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetUserId()).compareTo(typedOther.isSetUserId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, typedOther.userId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAge()).compareTo(typedOther.isSetAge()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAge()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.age, typedOther.age); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + case 1: // NAME + if (field.type == org.apache.thrift.protocol.TType.STRING) { + this.name = iprot.readString(); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + case 2: // USER_ID + if (field.type == org.apache.thrift.protocol.TType.STRING) { + this.userId = iprot.readString(); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + case 3: // AGE + if (field.type == org.apache.thrift.protocol.TType.I32) { + this.age = iprot.readI32(); + setAgeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + if (!isSetAge()) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'age' was not found in serialized data! Struct: " + toString()); + } + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (this.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(this.name); + oprot.writeFieldEnd(); + } + if (this.userId != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(this.userId); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(AGE_FIELD_DESC); + oprot.writeI32(this.age); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("User("); + boolean first = true; + + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + if (!first) sb.append(", "); + sb.append("userId:"); + if (this.userId == null) { + sb.append("null"); + } else { + sb.append(this.userId); + } + first = false; + if (!first) sb.append(", "); + sb.append("age:"); + sb.append(this.age); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (name == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'name' was not present! Struct: " + toString()); + } + if (userId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'userId' was not present! Struct: " + toString()); + } + // alas, we cannot check 'age' because it's a primitive and you chose the non-beans generator. + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bit_vector = new BitSet(1); + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } +} diff --git a/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/thrift/UserAccount.java b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/thrift/UserAccount.java new file mode 100644 index 000000000000..b97353b0b53b --- /dev/null +++ b/instrumentation/thrift/thrift-0.7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_7_0/thrift/UserAccount.java @@ -0,0 +1,418 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_7_0.thrift; + +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "all"}) +public class UserAccount + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("UserAccount"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + public User user; // required + public Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserAccount.class, metaDataMap); + } + + public UserAccount() {} + + public UserAccount(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public UserAccount(UserAccount other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public UserAccount deepCopy() { + return new UserAccount(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + public User getUser() { + return this.user; + } + + public UserAccount setUser(User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + public Account getAccount() { + return this.account; + } + + public UserAccount setAccount(Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof UserAccount) return this.equals((UserAccount) that); + return false; + } + + public boolean equals(UserAccount that) { + if (that == null) return false; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(UserAccount other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + UserAccount typedOther = (UserAccount) other; + + lastComparison = Boolean.valueOf(isSetUser()).compareTo(typedOther.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, typedOther.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAccount()).compareTo(typedOther.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, typedOther.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + case 1: // USER + if (field.type == org.apache.thrift.protocol.TType.STRUCT) { + this.user = new User(); + this.user.read(iprot); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + case 2: // ACCOUNT + if (field.type == org.apache.thrift.protocol.TType.STRUCT) { + this.account = new Account(); + this.account.read(iprot); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (this.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + this.user.write(oprot); + oprot.writeFieldEnd(); + } + if (this.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + this.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("UserAccount("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (user == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'user' was not present! Struct: " + toString()); + } + if (account == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'account' was not present! Struct: " + toString()); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.0-testing/build.gradle.kts b/instrumentation/thrift/thrift-0.9.0-testing/build.gradle.kts new file mode 100644 index 000000000000..cce0941d103e --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.0-testing/build.gradle.kts @@ -0,0 +1,12 @@ +plugins { + id("otel.javaagent-testing") +} + +dependencies { + testImplementation("org.apache.thrift:libthrift:0.9.0") + testImplementation("javax.annotation:javax.annotation-api:1.3.2") + + implementation(project(":instrumentation:thrift:thrift-0.7.0:javaagent")) { + exclude("org.apache.thrift", "libthrift") + } +} diff --git a/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/NoReturnTest.java b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/NoReturnTest.java new file mode 100644 index 000000000000..e37141287555 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/NoReturnTest.java @@ -0,0 +1,631 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_0; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_9_0.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFastFramedTransport; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class NoReturnTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + this.syncClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncClientSyncSimpleServerNoReturnMuti() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientNoReturn(port); + } + this.waitAndAssertTracesClientSyncServerSync("noReturn", 5); + } + + @Test + public void syncClientSyncSimpleServerNoReturnParallel() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientNoReturn(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerNoReturnParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("noReturn", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerNoReturn() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncClientSyncThreadPoolServerNoReturnMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientNoReturn(port); + } + this.waitAndAssertTracesClientSyncServerSync("noReturn", 5); + } + + @Test + public void syncClientSyncThreadPoolServerNoReturnParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientNoReturn(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerNoReturnParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("noReturn", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFastFramedClientSyncNonblockingServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncFastFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFramedClientSyncNonblockingFastServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncNonblockingFastServer(port); + this.syncFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFastFramedClientSyncNonblockingFastServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncNonblockingFastServer(port); + this.syncFastFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerNoReturnMuti() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + for (int i = 0; i < 5; ++i) { + this.syncFramedClientNoReturn(port); + } + this.waitAndAssertTracesClientSyncServerSync("noReturn", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerNoReturnParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientNoReturn(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("noReturn", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFastFramedClientSyncHsHaServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncFastFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFramedClientSyncHsHaFastServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncHsHaFastServer(port); + this.syncFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFastFramedClientSyncHsHaFastServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncHsHaFastServer(port); + this.syncFastFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerNoReturnMuti() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientNoReturn(port); + } + + this.waitAndAssertTracesClientSyncServerSync("noReturn", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerNoReturnParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientNoReturn(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("noReturn", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerNoReturn() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.nonBlockClientNoReturn(port); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerNoReturnMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientNoReturn(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerNoReturnParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientNoReturn(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerNoReturn() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.nonBlockClientNoReturn(port); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerNoReturnMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientNoReturn(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerNoReturnParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientNoReturn(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", threadCount); + } + + @Test + public void syncClientSyncNonblockingServerNoReturnError() { + int port = super.getPort(); + Exception error = null; + try { + this.startSyncNonblockingServer(port); + this.syncClientNoReturn(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("noReturn", 1); + } + + @Test + public void syncClientSyncHsHaServerNoReturnError() { + int port = super.getPort(); + Exception error = null; + try { + this.startSyncHsHaServer(port); + this.syncClientNoReturn(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("noReturn", 1); + } + + @Test + public void syncClientSyncThreadedSelectorServerNoReturnError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncClientNoReturn(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("noReturn", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFastFramedClientSyncThreadedSelectorServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncFastFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerNoReturnMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + for (int i = 0; i < 5; ++i) { + this.syncFramedClientNoReturn(port); + } + this.waitAndAssertTracesClientSyncServerSync("noReturn", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerNoReturnParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientNoReturn(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("noReturn", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerNoReturn() throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.nonBlockClientNoReturn(port); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerNoReturnMuti() + throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + for (int i = 0; i < 5; ++i) { + this.nonBlockClientNoReturn(port); + } + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerNoReturnParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientNoReturn(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorFastServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorFastServer(port); + this.syncFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFastFramedClientSyncThreadedSelectorFastServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorFastServer(port); + this.syncFastFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + public void syncClientNoReturn(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.noReturn(1)); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientNoReturn(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.noReturn_call s) {} + + @Override + public void onError(Exception e) { + throw new VerifyException("nonBlockClientNoReturn test failed", e); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.noReturn(1, callback)); + } + + public void syncFramedClientNoReturn(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.noReturn(1)); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFastFramedClientNoReturn(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFastFramedTransport framedTransport = new TFastFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.noReturn(1)); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientNoReturn(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.noReturn(1)); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/OneWayErrorTest.java b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/OneWayErrorTest.java new file mode 100644 index 000000000000..519ca5f54c70 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/OneWayErrorTest.java @@ -0,0 +1,555 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_0; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_9_0.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class OneWayErrorTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerOneWayWithError() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + this.syncClientOneWayWithError(port); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void syncClientSyncSimpleServerOneWayWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientOneWayWithError(port); + } + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void syncClientSyncSimpleServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientOneWayWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerOneWayWithError() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientOneWayWithError(port); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void syncClientSyncThreadPoolServerOneWayWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientOneWayWithError(port); + } + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void syncClientSyncThreadPoolServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientOneWayWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWayWithError() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncFramedClientOneWayWithError(port); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWayWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWayWithError(port); + } + + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWayWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWayWithError() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncFramedClientOneWayWithError(port); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWayWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWayWithError(port); + } + + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWayWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWayWithError() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.nonBlockClientOneWayWithError(port); + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWayWithErrorMuti() + throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWayWithError(port); + } + + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWayWithError(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWayWithError() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.nonBlockClientOneWayWithError(port); + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWayWithErrorMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWayWithError(port); + } + + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWayWithError(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void syncClientSyncNonblockingServerOneWayWithErrorError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncClientOneWayWithError(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWayWithError", 1); + } + + @Test + public void syncClientSyncHsHaServerOneWayWithErrorError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncClientOneWayWithError(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWayWithError", 1); + } + + public void syncClientOneWayWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.oneWayWithError()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + @Test + public void syncClientSyncThreadedSelectorServerOneWayWithErrorError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncClientOneWayWithError(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWayWithError", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerOneWayWithError() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncFramedClientOneWayWithError(port); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerOneWayWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWayWithError(port); + } + + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWayWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerOneWayWithError() + throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.nonBlockClientOneWayWithError(port); + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerOneWayWithErrorMuti() + throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWayWithError(port); + } + + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWayWithError(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + public void nonBlockClientOneWayWithError(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.oneWayWithError_call no) {} + + @Override + public void onError(Exception e) { + throw new VerifyException("nonBlockClientOneWayWithError test failed", e); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.oneWayWithError(callback)); + } + + public void syncFramedClientOneWayWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.oneWayWithError()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientOneWayWithError(int port) throws IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.oneWayWithError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/OneWayTest.java b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/OneWayTest.java new file mode 100644 index 000000000000..ac635a57ced3 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/OneWayTest.java @@ -0,0 +1,548 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_0; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_9_0.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class OneWayTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerOneWay() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + this.syncClientOneWay(port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", 1); + } + + @Test + public void syncClientSyncSimpleServerOneWayMuti() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientOneWay(port); + } + this.waitAndAssertTracesClientSyncServerSync("oneWay", 5); + } + + @Test + public void syncClientSyncSimpleServerOneWayParallel() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientOneWay(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerOneWay() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientOneWay(port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", 1); + } + + @Test + public void syncClientSyncThreadPoolServerOneWayMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientOneWay(port); + } + this.waitAndAssertTracesClientSyncServerSync("oneWay", 5); + } + + @Test + public void syncClientSyncThreadPoolServerOneWayParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientOneWay(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWay() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncFramedClientOneWay(port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWayMuti() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWay(port); + } + + this.waitAndAssertTracesClientSyncServerSync("oneWay", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWayParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWay(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWay() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncFramedClientOneWay(port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWayMuti() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWay(port); + } + + this.waitAndAssertTracesClientSyncServerSync("oneWay", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWayParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWay(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWay() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.nonBlockClientOneWay(port); + this.waitAndAssertTracesClientAsyncServerSync("oneWay", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWayMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWay(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("oneWay", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWayParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWay(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("oneWay", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWay() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.nonBlockClientOneWay(port); + this.waitAndAssertTracesClientAsyncServerSync("oneWay", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWayMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWay(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("oneWay", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWayParallel() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWay(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("oneWay", threadCount); + } + + @Test + public void syncClientSyncNonblockingServerOneWayError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncClientOneWay(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWay", 1); + } + + @Test + public void syncClientSyncHsHaServerOneWayError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncClientOneWay(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWay", 1); + } + + @Test + public void syncClientSyncThreadedSelectorServerOneWayError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncClientOneWay(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWay", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerOneWay() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncFramedClientOneWay(port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerOneWayMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWay(port); + } + + this.waitAndAssertTracesClientSyncServerSync("oneWay", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerOneWayParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWay(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerOneWay() throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.nonBlockClientOneWay(port); + this.waitAndAssertTracesClientAsyncServerSync("oneWay", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerOneWayMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWay(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("oneWay", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerOneWayParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWay(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("oneWay", threadCount); + } + + public void syncClientOneWay(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.oneWay()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientOneWay(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.oneWay_call no) {} + + @Override + public void onError(Exception e) { + throw new VerifyException("nonBlockClientOneWay test failed", e); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.oneWay(callback)); + } + + public void syncFramedClientOneWay(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.oneWay()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientOneWay(int port) throws IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.oneWay()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/SayHelloTest.java b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/SayHelloTest.java new file mode 100644 index 000000000000..c0b4f58e8ea2 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/SayHelloTest.java @@ -0,0 +1,641 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_0; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_9_0.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFastFramedTransport; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class SayHelloTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + this.syncClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncClientSyncSimpleServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientSayHello(port); + } + this.waitAndAssertTracesClientSyncServerSync("sayHello", 5); + } + + @Test + public void syncClientSyncSimpleServerSayHelloParallel() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientSayHello(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("sayHello", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerSayHello() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncClientSyncThreadPoolServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientSayHello(port); + } + this.waitAndAssertTracesClientSyncServerSync("sayHello", 5); + } + + @Test + public void syncClientSyncThreadPoolServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientSayHello(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("sayHello", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFastFramedClientSyncNonblockingServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncFastFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFramedClientSyncNonblockingFastServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncNonblockingFastServer(port); + this.syncFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFastFramedClientSyncNonblockingFastServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncNonblockingFastServer(port); + this.syncFastFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + for (int i = 0; i < 5; ++i) { + this.syncFramedClientSayHello(port); + } + this.waitAndAssertTracesClientSyncServerSync("sayHello", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientSayHello(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("sayHello", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFastFramedClientSyncHsHaServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncFastFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFramedClientSyncHsHaFastServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncHsHaFastServer(port); + this.syncFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFastFramedClientSyncHsHaFastServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncHsHaFastServer(port); + this.syncFastFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientSayHello(port); + } + + this.waitAndAssertTracesClientSyncServerSync("sayHello", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientSayHello(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("sayHello", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHello() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.nonBlockClientSayHello(port); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHelloMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientSayHello(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientSayHello(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHello() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.nonBlockClientSayHello(port); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHelloMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientSayHello(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientSayHello(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", threadCount); + } + + @Test + public void syncClientSyncNonblockingServerSayHelloError() { + int port = super.getPort(); + Exception error = null; + try { + this.startSyncNonblockingServer(port); + this.syncClientSayHello(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("sayHello", 1); + } + + @Test + public void syncClientSyncHsHaServerSayHelloError() { + int port = super.getPort(); + Exception error = null; + try { + this.startSyncHsHaServer(port); + this.syncClientSayHello(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("sayHello", 1); + } + + @Test + public void syncClientSyncThreadedSelectorServerSayHelloError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncClientSayHello(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("sayHello", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFastFramedClientSyncThreadedSelectorServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncFastFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + for (int i = 0; i < 5; ++i) { + this.syncFramedClientSayHello(port); + } + this.waitAndAssertTracesClientSyncServerSync("sayHello", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientSayHello(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("sayHello", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerSayHello() throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.nonBlockClientSayHello(port); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerSayHelloMuti() + throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + for (int i = 0; i < 5; ++i) { + this.nonBlockClientSayHello(port); + } + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientSayHello(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorFastServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorFastServer(port); + this.syncFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFastFramedClientSyncThreadedSelectorFastServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorFastServer(port); + this.syncFastFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + public void syncClientSayHello(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.sayHello("US", "Bob")); + Assertions.assertThat(response).isEqualTo("Hello USs' Bob"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientSayHello(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.sayHello_call s) { + try { + String result = s.getResult(); + Assertions.assertThat(result).isEqualTo("Hello USs' Bob"); + } catch (TException e) { + throw new VerifyException(e); + } + } + + @Override + public void onError(Exception e) { + throw new VerifyException("nonBlockClientSayHello test failed", e); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.sayHello("US", "Bob", callback)); + } + + public void syncFramedClientSayHello(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.sayHello("US", "Bob")); + Assertions.assertThat(response).isEqualTo("Hello USs' Bob"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFastFramedClientSayHello(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFastFramedTransport framedTransport = new TFastFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.sayHello("US", "Bob")); + Assertions.assertThat(response).isEqualTo("Hello USs' Bob"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientSayHello(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.sayHello("US", "Bob")); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/TestSaslCallbackHandler.java b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/TestSaslCallbackHandler.java new file mode 100644 index 000000000000..a87393e069be --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/TestSaslCallbackHandler.java @@ -0,0 +1,47 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_0; + +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.NameCallback; +import javax.security.auth.callback.PasswordCallback; +import javax.security.auth.callback.UnsupportedCallbackException; +import javax.security.sasl.AuthorizeCallback; +import javax.security.sasl.RealmCallback; + +public class TestSaslCallbackHandler implements CallbackHandler { + public static final String PRINCIPAL = "thrift-test-principal"; + public static final String REALM = "thrift-test-realm"; + private final String password; + + public TestSaslCallbackHandler(String password) { + this.password = password; + } + + @Override + public void handle(Callback[] callbacks) throws UnsupportedCallbackException { + Callback[] var2 = callbacks; + int var3 = callbacks.length; + + for (int var4 = 0; var4 < var3; ++var4) { + Callback c = var2[var4]; + if (c instanceof NameCallback) { + ((NameCallback) c).setName("thrift-test-principal"); + } else if (c instanceof PasswordCallback) { + ((PasswordCallback) c).setPassword(this.password.toCharArray()); + } else if (c instanceof AuthorizeCallback) { + ((AuthorizeCallback) c).setAuthorized(true); + } else { + if (!(c instanceof RealmCallback)) { + throw new UnsupportedCallbackException(c); + } + + ((RealmCallback) c).setText("thrift-test-realm"); + } + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/ThriftBaseTest.java b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/ThriftBaseTest.java new file mode 100644 index 000000000000..146296260e21 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/ThriftBaseTest.java @@ -0,0 +1,799 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_0; + +import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo; +import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.satisfies; + +import com.google.common.base.VerifyException; +import io.opentelemetry.api.common.AttributeKey; +import io.opentelemetry.api.trace.SpanKind; +import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension; +import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; +import io.opentelemetry.instrumentation.thrift.v0_9_0.server.ThriftServiceImpl; +import io.opentelemetry.instrumentation.thrift.v0_9_0.thrift.ThriftService; +import io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions; +import io.opentelemetry.sdk.testing.assertj.SpanDataAssert; +import io.opentelemetry.sdk.testing.assertj.TraceAssert; +import io.opentelemetry.sdk.trace.data.StatusData; +import io.opentelemetry.semconv.SemanticAttributes; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.nio.charset.Charset; +import java.util.Random; +import java.util.function.Consumer; +import java.util.logging.Logger; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.server.THsHaServer; +import org.apache.thrift.server.TNonblockingServer; +import org.apache.thrift.server.TServer; +import org.apache.thrift.server.TSimpleServer; +import org.apache.thrift.server.TThreadPoolServer; +import org.apache.thrift.server.TThreadedSelectorServer; +import org.apache.thrift.transport.TFastFramedTransport; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingServerSocket; +import org.apache.thrift.transport.TNonblockingServerTransport; +import org.apache.thrift.transport.TServerSocket; +import org.apache.thrift.transport.TServerTransport; +import org.apache.thrift.transport.TTransportException; +import org.assertj.core.api.AbstractAssert; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.extension.RegisterExtension; + +public abstract class ThriftBaseTest { + private static final Logger logger = Logger.getLogger(ThriftBaseTest.class.getName()); + public TServer server; + public int port = 13100; + + private static final String ASYNC_CLIENT = + "io.opentelemetry.instrumentation.thrift.v0_9_0.thrift.ThriftService$AsyncClient"; + private static final String SYNC_CLIENT = + "io.opentelemetry.instrumentation.thrift.v0_9_0.thrift.ThriftService$Client"; + private static final String ASYNC_SERVER = + "io.opentelemetry.instrumentation.thrift.v0_9_0.server.ThriftServiceAsyncImpl"; + private static final String SYNC_SERVER = + "io.opentelemetry.instrumentation.thrift.v0_9_0.server.ThriftServiceImpl"; + private static final String PEER_NAME = "localhost"; + private static final String PEER_ADDR = "127.0.0.1"; + + private static final String TRANSPORT_EXCEPTION = + "org.apache.thrift.transport.TTransportException"; + private static final String VERIFY_EXCEPTION = "com.google.common.base.VerifyException"; + private static final String APP_EXCEPTION = "org.apache.thrift.TApplicationException"; + private static final String IO_EXCEPTION = "java.io.IOException"; + private static final String NULL_EXCEPTION = "java.lang.NullPointerException"; + + @RegisterExtension + public static InstrumentationExtension testing = AgentInstrumentationExtension.create(); + + protected InstrumentationExtension testing() { + return testing; + } + + @BeforeEach + public void before() { + ++this.port; + logger.info( + "before port=" + + this.port + + ", threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.testing().clearData(); + } + + @AfterEach + public void after() { + this.stopServer(); + } + + public int getPort() { + Random random = new Random(); + int newPort = this.port + random.nextInt(2000); + while (portNotRelease(newPort)) { + newPort = this.port + random.nextInt(2000); + } + return newPort; + } + + public void startSyncSimpleServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TServerTransport serverTransport = new TServerSocket(port); + this.server = new TSimpleServer(new TServer.Args(serverTransport).processor(processor)); + new Thread( + () -> { + logger.info( + "Starting startSyncSimpleServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startSyncNonblockingServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerSocket transport = new TNonblockingServerSocket(port); + TNonblockingServer.Args serverArgs = + new TNonblockingServer.Args(transport).processor(processor); + this.server = new TNonblockingServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startNonBlockingServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startSyncNonblockingFastServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TNonblockingServer.Args serverArgs = + new TNonblockingServer.Args(transport) + .processor(processor) + .transportFactory(new TFastFramedTransport.Factory()) + .protocolFactory(new TBinaryProtocol.Factory()); + this.server = new TNonblockingServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startNonBlockingServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startSyncThreadPoolServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TServerSocket transport = new TServerSocket(port); + TThreadPoolServer.Args serverArgs = new TThreadPoolServer.Args(transport).processor(processor); + TServer server = new TThreadPoolServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startSyncThreadPoolServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + server.serve(); + }) + .start(); + } + + public void startSyncHsHaServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TBinaryProtocol.Factory protocolFactory = new TBinaryProtocol.Factory(); + TFramedTransport.Factory transportFactory = new TFramedTransport.Factory(); + THsHaServer.Args serverArgs = + new THsHaServer.Args(transport) + .processor(processor) + .protocolFactory(protocolFactory) + .transportFactory(transportFactory); + this.server = new THsHaServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startSyncTHsHaServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startSyncHsHaFastServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TBinaryProtocol.Factory protocolFactory = new TBinaryProtocol.Factory(); + TFastFramedTransport.Factory transportFactory = new TFastFramedTransport.Factory(); + THsHaServer.Args serverArgs = + new THsHaServer.Args(transport) + .processor(processor) + .protocolFactory(protocolFactory) + .transportFactory(transportFactory); + this.server = new THsHaServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startSyncTHsHaServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startSyncThreadedSelectorServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TThreadedSelectorServer.Args serverArgs = + new TThreadedSelectorServer.Args(transport) + .selectorThreads(5) + .workerThreads(10) + .acceptQueueSizePerThread(20) + .processor(processor); + this.server = new TThreadedSelectorServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startAsyncServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startSyncThreadedSelectorFastServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TThreadedSelectorServer.Args serverArgs = + new TThreadedSelectorServer.Args(transport) + .selectorThreads(5) + .workerThreads(10) + .acceptQueueSizePerThread(20) + .processor(processor) + .transportFactory(new TFastFramedTransport.Factory()); + this.server = new TThreadedSelectorServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startAsyncServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + @SuppressWarnings("Interruption") + public void stopServer() { + if (this.server != null) { + this.server.stop(); + } + } + + public static boolean portNotRelease(int port) { + // 查找占用端口的进程 ID + Process process = null; + String pid = null; // 获取 PID + try { + process = Runtime.getRuntime().exec("lsof -ti:" + port); + BufferedReader reader = + new BufferedReader( + new InputStreamReader(process.getInputStream(), Charset.defaultCharset())); + pid = reader.readLine(); + } catch (IOException e) { + throw new VerifyException(e); + } + return pid != null && !pid.isEmpty(); + } + + public void waitAndAssertTracesClientSyncServerSync(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.unset(), + null, + null); + } + + public void waitAndAssertTracesClientSyncServerSync( + String clientMethod, String serverMethod, int count) { + this.baseWaitAndAssertTraces( + clientMethod, + serverMethod, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.unset(), + null, + null); + } + + public void waitAndAssertTracesClientSyncServerSyncOneWay(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.error(), + val -> + val.isIn( + "Cannot invoke \"org.apache.thrift.TBase.write(org.apache.thrift.protocol.TProtocol)\" because \"result\" is null"), + NULL_EXCEPTION); + } + + @SuppressWarnings("UngroupedOverloads") + public void waitAndAssertTracesClientSyncServerSyncWithError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> val.isIn("Internal error processing withError"), + APP_EXCEPTION, + SYNC_SERVER, + StatusData.unset(), + null, + null); + } + + public void waitAndAssertTracesClientSyncServerSyncWithError( + String clientMethod, String serverMethod, int count) { + this.baseWaitAndAssertTraces( + clientMethod, + serverMethod, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.unset(), + null, + null); + } + + public void waitAndAssertTracesClientSyncServerSyncOnewayError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.unset(), + null, + null); + } + + public void waitAndAssertTracesClientSyncServerSyncOnewayError( + String clientMethod, String serverMethod, int count) { + this.baseWaitAndAssertTraces( + clientMethod, + serverMethod, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientAsyncServerAsync(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + ASYNC_SERVER, + StatusData.unset(), + null, + null); + } + + public void waitAndAssertTracesClientAsyncServerAsyncError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + ASYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientAsyncServerAsyncWithError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> val.isIn("Read call frame size failed", "fail"), + IO_EXCEPTION, + ASYNC_SERVER, + StatusData.error(), + val -> val.isIn("Read call frame size failed", "fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientAsyncServerSync(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.unset(), + null, + null); + } + + public void waitAndAssertTracesClientAsyncServerSyncOneWay(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.error(), + val -> + val.isIn( + "Cannot invoke \"org.apache.thrift.TBase.write(org.apache.thrift.protocol.TProtocol)\" because \"result\" is null"), + NULL_EXCEPTION); + } + + public void waitAndAssertTracesClientAsyncServerSyncWithError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.unset(), + null, + null); + } + + public void waitAndAssertTracesClientAsyncServerSyncOnewayError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.unset(), + null, + null); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) // 测试代码 + public void waitAndAssertTracesClientSyncServerAsync(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + ASYNC_SERVER, + StatusData.unset(), + null, + null); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) // 测试代码 + public void waitAndAssertTracesClientSyncServerAsyncError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + ASYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) // 测试代码 + public void waitAndAssertTracesClientSyncServerAsyncWithError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> val.isIn(null, "fail"), + TRANSPORT_EXCEPTION, + ASYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientSyncNoServer(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> + val.isIn( + null, "Socket is closed by peer.", "java.net.SocketException: Connection reset"), + TRANSPORT_EXCEPTION, + null, + null, + null, + null); + } + + public void waitAndAssertTracesClientSyncNoServerOneway(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + null, + null, + null, + null); + } + + public void waitAndAssertTracesClientSyncNoServerNoSasl(String method, int count) { + this.baseWaitAndAssertTraces( + method, + null, + count, + SYNC_CLIENT, + StatusData.error(), + null, + null, + val -> val.isIn("SASL authentication not complete"), + TRANSPORT_EXCEPTION, + null, + null, + null, + null); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) // 测试代码 + private void baseWaitAndAssertTraces( + String clientMethod, + String serverMethod, + int count, + String clientClass, + StatusData clientStatus, + String peerName, + String peerAddr, + OpenTelemetryAssertions.StringAssertConsumer clientAssertion, + String clientErrorType, + String serverClass, + StatusData serverStatus, + OpenTelemetryAssertions.StringAssertConsumer serviceAssertion, + String serverErrorType) { + Consumer[] consumers = new Consumer[count]; + Consumer traceAssertConsumer; + if (serverClass == null) { + traceAssertConsumer = + trace -> + trace.hasSpansSatisfyingExactly( + span -> span.hasName("parent").hasKind(SpanKind.INTERNAL).hasNoParent(), + clientSpanDataAssertConsumer( + clientMethod, + clientClass, + clientStatus, + trace, + peerName, + peerAddr, + clientAssertion, + clientErrorType)); + } else { + traceAssertConsumer = + trace -> + trace.hasSpansSatisfyingExactly( + span -> span.hasName("parent").hasKind(SpanKind.INTERNAL).hasNoParent(), + clientSpanDataAssertConsumer( + clientMethod, + clientClass, + clientStatus, + trace, + peerName, + peerAddr, + clientAssertion, + clientErrorType), + serverSpanDataAssertConsumer( + serverMethod, + serverClass, + serverStatus, + trace, + serviceAssertion, + serverErrorType)); + } + + for (int i = 0; i < count; ++i) { + consumers[i] = traceAssertConsumer; + } + this.testing().waitAndAssertTraces(consumers); + } + + @SuppressWarnings({"ReturnValueIgnored"}) + private static Consumer clientSpanDataAssertConsumer( + String clientMethod, + String clientClass, + StatusData statusData, + TraceAssert trace, + String peerName, + String peerAddr, + OpenTelemetryAssertions.StringAssertConsumer errorMsgAssertion, + String errorType) { + Consumer consumer = + span -> + span.hasName(clientMethod) + .hasKind(SpanKind.CLIENT) + .hasParent(trace.getSpan(0)) + .hasStatus(statusData) + .hasAttributesSatisfying( + equalTo(AttributeKey.stringKey("net.sock.peer.name"), peerName), + equalTo(AttributeKey.stringKey("net.sock.peer.addr"), peerAddr), + equalTo(SemanticAttributes.RPC_SYSTEM, "thrift"), + equalTo(SemanticAttributes.RPC_SERVICE, clientClass), + equalTo(SemanticAttributes.RPC_METHOD, clientMethod)); + if (statusData == StatusData.error()) { + consumer = + consumer.andThen( + span -> + span.hasEventsSatisfyingExactly( + event -> + event + .hasName(SemanticAttributes.EXCEPTION_EVENT_NAME) + .hasAttributesSatisfyingExactly( + satisfies( + SemanticAttributes.EXCEPTION_MESSAGE, errorMsgAssertion), + satisfies( + AttributeKey.stringKey("exception.stacktrace"), + AbstractAssert::isNotNull), + equalTo(SemanticAttributes.EXCEPTION_TYPE, errorType)))); + } + return consumer; + } + + @SuppressWarnings({"ReturnValueIgnored"}) + private static Consumer serverSpanDataAssertConsumer( + String serverMethod, + String serverClass, + StatusData statusData, + TraceAssert trace, + OpenTelemetryAssertions.StringAssertConsumer errorMsgAssertion, + String errorType) { + Consumer consumer = + span -> + span.hasName(serverMethod) + .hasKind(SpanKind.SERVER) + .hasParent(trace.getSpan(1)) + .hasStatus(statusData) + .hasAttributesSatisfying( + equalTo(AttributeKey.stringKey("net.sock.peer.addr"), "127.0.0.1"), + equalTo(SemanticAttributes.RPC_SYSTEM, "thrift"), + equalTo(SemanticAttributes.RPC_SERVICE, serverClass), + equalTo(SemanticAttributes.RPC_METHOD, serverMethod)); + if (statusData == StatusData.error()) { + consumer = + consumer.andThen( + span -> + span.hasEventsSatisfyingExactly( + event -> + event + .hasName(SemanticAttributes.EXCEPTION_EVENT_NAME) + .hasAttributesSatisfyingExactly( + satisfies( + SemanticAttributes.EXCEPTION_MESSAGE, errorMsgAssertion), + satisfies( + AttributeKey.stringKey("exception.stacktrace"), + AbstractAssert::isNotNull), + equalTo(SemanticAttributes.EXCEPTION_TYPE, errorType)))); + } + return consumer; + } +} diff --git a/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/WithDelayTest.java b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/WithDelayTest.java new file mode 100644 index 000000000000..8f3456854e76 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/WithDelayTest.java @@ -0,0 +1,559 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_0; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_9_0.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class WithDelayTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + this.syncClientWithDelay(port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", 1); + } + + @Test + public void syncClientSyncSimpleServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithDelay(port, 2); + } + this.waitAndAssertTracesClientSyncServerSync("withDelay", 5); + } + + @Test + public void syncClientSyncSimpleServerSayHelloParallel() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithDelay(port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withDelay", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerSayHello() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientWithDelay(port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", 1); + } + + @Test + public void syncClientSyncThreadPoolServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithDelay(port, 2); + } + this.waitAndAssertTracesClientSyncServerSync("withDelay", 5); + } + + @Test + public void syncClientSyncThreadPoolServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithDelay(port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withDelay", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncFramedClientWithDelay(port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithDelay(port, 2); + } + + this.waitAndAssertTracesClientSyncServerSync("withDelay", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithDelay(port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withDelay", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncFramedClientWithDelay(port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithDelay(port, 2); + } + + this.waitAndAssertTracesClientSyncServerSync("withDelay", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithDelay(port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withDelay", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHello() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.nonBlockClientWithDelay(port, 2); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHelloMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithDelay(port, 1); + } + + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithDelay(port, 1); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHello() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.nonBlockClientWithDelay(port, 2); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHelloMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithDelay(port, 2); + } + + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithDelay(port, 2); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", threadCount); + } + + @Test + public void syncClientSyncNonblockingServerSayHelloError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncClientWithDelay(port, 2); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withDelay", 1); + } + + @Test + public void syncClientSyncHsHaServerSayHelloError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncClientWithDelay(port, 2); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withDelay", 1); + } + + @Test + public void syncClientSyncThreadedSelectorServerSayHelloError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncClientWithDelay(port, 2); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withDelay", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncFramedClientWithDelay(port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithDelay(port, 2); + } + + this.waitAndAssertTracesClientSyncServerSync("withDelay", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithDelay(port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withDelay", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerSayHello() throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.nonBlockClientWithDelay(port, 2); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerSayHelloMuti() + throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithDelay(port, 2); + } + + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithDelay(port, 2); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", threadCount); + } + + public void syncClientWithDelay(int port, int delay) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.withDelay(delay)); + Assertions.assertThat(response).isEqualTo("delay " + delay); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientWithDelay(int port, int delay) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.withDelay_call s) { + try { + String result = s.getResult(); + Assertions.assertThat(result).isEqualTo("delay " + delay); + } catch (TException e) { + throw new VerifyException(e); + } + } + + @Override + public void onError(Exception e) { + throw new VerifyException("nonBlockClientWithDelay test failed", e); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.withDelay(delay, callback)); + } + + public void syncFramedClientWithDelay(int port, int delay) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.withDelay(delay)); + Assertions.assertThat(response).isEqualTo("delay " + delay); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientWithDelay(int port, int delay) throws IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withDelay(delay)); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/WithErrorTest.java b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/WithErrorTest.java new file mode 100644 index 000000000000..d17870e3ca0d --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/WithErrorTest.java @@ -0,0 +1,572 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_0; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_9_0.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class WithErrorTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerWithError() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + this.syncClientWithError(port); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 1); + } + + @Test + public void syncClientSyncSimpleServerWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithError(port); + } + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 5); + } + + @Test + public void syncClientSyncSimpleServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerWithError() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientWithError(port); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 1); + } + + @Test + public void syncClientSyncThreadPoolServerWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithError(port); + } + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 5); + } + + @Test + public void syncClientSyncThreadPoolServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithError() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncFramedClientWithError(port); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithError(port); + } + + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerWithError() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncFramedClientWithError(port); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithError(port); + } + + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithError() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.nonBlockClientWithError(port); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithErrorMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithError(port); + } + + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithError(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerWithError() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.nonBlockClientWithError(port); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerWithErrorMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithError(port); + } + + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithError(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncClientSyncNonblockingServerWithErrorError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncClientWithError(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServer("withError", 1); + } + + @Test + public void syncClientSyncHsHaServerWithErrorError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncClientWithError(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServer("withError", 1); + } + + @Test + public void syncClientSyncThreadedSelectorServerWithErrorError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncClientWithError(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServer("withError", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithError() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncFramedClientWithError(port); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithError(port); + } + + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithError() throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.nonBlockClientWithError(port); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithErrorMuti() + throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithError(port); + } + + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithError(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", threadCount); + } + + public void syncClientWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientWithError(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.withError_call s) { + try { + String result = s.getResult(); + Assertions.assertThat(result).isEqualTo("Hello USs' Bob"); + } catch (TException e) { + throw new VerifyException(e); + } + } + + @Override + public void onError(Exception e) { + Assertions.assertThat(e).isNotNull(); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.withError(callback)); + } + + public void syncFramedClientWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientWithError(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/WithStructTest.java b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/WithStructTest.java new file mode 100644 index 000000000000..bc5ff67e73e1 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/WithStructTest.java @@ -0,0 +1,572 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_0; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_9_0.thrift.Account; +import io.opentelemetry.instrumentation.thrift.v0_9_0.thrift.ThriftService; +import io.opentelemetry.instrumentation.thrift.v0_9_0.thrift.User; +import io.opentelemetry.instrumentation.thrift.v0_9_0.thrift.UserAccount; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class WithStructTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerWithStruct() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + this.syncClientWithStruct(port); + this.waitAndAssertTracesClientSyncServerSync("data", 1); + } + + @Test + public void syncClientSyncSimpleServerWithStructMuti() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithStruct(port); + } + this.waitAndAssertTracesClientSyncServerSync("data", 5); + } + + @Test + public void syncClientSyncSimpleServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithStruct(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerWithStruct() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientWithStruct(port); + this.waitAndAssertTracesClientSyncServerSync("data", 1); + } + + @Test + public void syncClientSyncThreadPoolServerWithStructMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithStruct(port); + } + this.waitAndAssertTracesClientSyncServerSync("data", 5); + } + + @Test + public void syncClientSyncThreadPoolServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithStruct(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithStruct() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncFramedClientWithStruct(port); + this.waitAndAssertTracesClientSyncServerSync("data", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithStructMuti() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithStruct(port); + } + + this.waitAndAssertTracesClientSyncServerSync("data", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithStruct(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerWithStruct() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncFramedClientWithStruct(port); + this.waitAndAssertTracesClientSyncServerSync("data", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerWithStructMuti() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithStruct(port); + } + + this.waitAndAssertTracesClientSyncServerSync("data", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithStruct(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithStruct() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.nonBlockClientWithStruct(port); + this.waitAndAssertTracesClientAsyncServerSync("data", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithStructMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithStruct(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("data", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithStruct(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("data", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerWithStruct() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.nonBlockClientWithStruct(port); + this.waitAndAssertTracesClientAsyncServerSync("data", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerWithStructMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithStruct(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("data", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithStruct(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("data", threadCount); + } + + @Test + public void syncClientSyncNonblockingServerWithStructError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncClientWithStruct(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("data", 1); + } + + @Test + public void syncClientSyncHsHaServerWithStructError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncClientWithStruct(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("data", 1); + } + + @Test + public void syncClientSyncThreadedSelectorServerWithStructError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncClientWithStruct(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("data", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithStruct() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncFramedClientWithStruct(port); + this.waitAndAssertTracesClientSyncServerSync("data", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithStructMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithStruct(port); + } + + this.waitAndAssertTracesClientSyncServerSync("data", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithStruct(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithStruct() throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.nonBlockClientWithStruct(port); + this.waitAndAssertTracesClientAsyncServerSync("data", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithStructMuti() + throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithStruct(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("data", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithStruct(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("data", threadCount); + } + + public void syncClientWithStruct(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + UserAccount response = this.testing().runWithSpan("parent", () -> client.data(user, account)); + Assertions.assertThat(response.user).isEqualTo(user); + Assertions.assertThat(response.account).isEqualTo(account); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientWithStruct(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.data_call response) { + try { + UserAccount result = response.getResult(); + Assertions.assertThat(result.user).isEqualTo(user); + Assertions.assertThat(result.account).isEqualTo(account); + } catch (TException e) { + throw new VerifyException(e); + } + } + + @Override + public void onError(Exception e) { + throw new VerifyException("asyncClientWithStruct test failed", e); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.data(user, account, callback)); + } + + public void syncFramedClientWithStruct(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + UserAccount response = this.testing().runWithSpan("parent", () -> client.data(user, account)); + Assertions.assertThat(response.user).isEqualTo(user); + Assertions.assertThat(response.account).isEqualTo(account); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientWithStruct(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + UserAccount response = this.testing().runWithSpan("parent", () -> client.data(user, account)); + Assertions.assertThat(response.user).isEqualTo(user); + Assertions.assertThat(response.account).isEqualTo(account); + } +} diff --git a/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/WithoutArgsTest.java b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/WithoutArgsTest.java new file mode 100644 index 000000000000..18d9ca8b72cf --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/WithoutArgsTest.java @@ -0,0 +1,562 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_0; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_9_0.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class WithoutArgsTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerWithoutArgs() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + this.syncClientWithoutArgs(port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 1); + } + + @Test + public void syncClientSyncSimpleServerWithoutArgsMuti() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithoutArgs(port); + } + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 5); + } + + @Test + public void syncClientSyncSimpleServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithoutArgs(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerWithoutArgs() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientWithoutArgs(port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 1); + } + + @Test + public void syncClientSyncThreadPoolServerWithoutArgsMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithoutArgs(port); + } + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 5); + } + + @Test + public void syncClientSyncThreadPoolServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithoutArgs(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithoutArgs() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncFramedClientWithoutArgs(port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithoutArgsMuti() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithoutArgs(port); + } + + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithoutArgs(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerWithoutArgs() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncFramedClientWithoutArgs(port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerWithoutArgsMuti() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithoutArgs(port); + } + + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithoutArgs(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithoutArgs() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.nonBlockClientWithoutArgs(port); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithoutArgsMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithoutArgs(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithoutArgs(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerWithoutArgs() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.nonBlockClientWithoutArgs(port); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerWithoutArgsMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithoutArgs(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithoutArgs(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncClientSyncNonblockingServerWithoutArgsError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncClientWithoutArgs(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withoutArgs", 1); + } + + @Test + public void syncClientSyncHsHaServerWithoutArgsError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncClientWithoutArgs(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withoutArgs", 1); + } + + @Test + public void syncClientSyncThreadedSelectorServerWithoutArgsError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncClientWithoutArgs(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withoutArgs", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithoutArgs() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncFramedClientWithoutArgs(port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithoutArgsMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithoutArgs(port); + } + + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithoutArgs(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithoutArgs() throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.nonBlockClientWithoutArgs(port); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithoutArgsMuti() + throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithoutArgs(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithoutArgs(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", threadCount); + } + + public void syncClientWithoutArgs(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.withoutArgs()); + Assertions.assertThat(response).isEqualTo("no args"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientWithoutArgs(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.withoutArgs_call s) { + try { + String result = s.getResult(); + Assertions.assertThat(result).isEqualTo("no args"); + } catch (TException e) { + throw new VerifyException(e); + } + } + + @Override + public void onError(Exception e) { + throw new VerifyException("asyncClientWithoutArgs test failed", e); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.withoutArgs(callback)); + } + + public void syncFramedClientWithoutArgs(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.withoutArgs()); + Assertions.assertThat(response).isEqualTo("no args"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientWithoutArgs(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withoutArgs()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/server/ThriftServiceAsyncImpl.java b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/server/ThriftServiceAsyncImpl.java new file mode 100644 index 000000000000..4b39d3068eba --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/server/ThriftServiceAsyncImpl.java @@ -0,0 +1,77 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_0.server; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_9_0.thrift.Account; +import io.opentelemetry.instrumentation.thrift.v0_9_0.thrift.ThriftService; +import io.opentelemetry.instrumentation.thrift.v0_9_0.thrift.User; +import io.opentelemetry.instrumentation.thrift.v0_9_0.thrift.UserAccount; +import java.util.concurrent.TimeUnit; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused", "all"}) +public class ThriftServiceAsyncImpl implements ThriftService.AsyncIface { + public ThriftServiceAsyncImpl() {} + + @Override + public void sayHello(String zone, String name, AsyncMethodCallback resultHandler) + throws TException { + resultHandler.onComplete("Hello " + zone + "s' " + name); + } + + @Override + public void withDelay(int delay, AsyncMethodCallback resultHandler) throws TException { + try { + TimeUnit.SECONDS.sleep(delay); + } catch (InterruptedException var4) { + InterruptedException e = var4; + throw new VerifyException(e); + } + + resultHandler.onComplete("delay " + delay); + } + + @Override + public void withoutArgs(AsyncMethodCallback resultHandler) throws TException { + resultHandler.onComplete("no args"); + } + + @Override + public void withError(AsyncMethodCallback resultHandler) throws TException { + throw new VerifyException("fail"); + } + + @Override + public void withCollisioin(String input, AsyncMethodCallback resultHandler) throws TException { + resultHandler.onComplete(input); + } + + @Override + public void oneWayHasArgs(int delay, AsyncMethodCallback resultHandler) throws TException {} + + @Override + public void oneWay(AsyncMethodCallback resultHandler) throws TException {} + + @Override + public void oneWayWithError(AsyncMethodCallback resultHandler) throws TException { + throw new VerifyException("fail"); + } + + @Override + public void data(User user, Account account, AsyncMethodCallback resultHandler) + throws TException { + resultHandler.onComplete(new UserAccount(user, account)); + } + + @Override + public void noReturn( + int delay, AsyncMethodCallback resultHandler) + throws TException { + resultHandler.onComplete(null); + } +} diff --git a/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/server/ThriftServiceImpl.java b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/server/ThriftServiceImpl.java new file mode 100644 index 000000000000..b0a920b4df08 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/server/ThriftServiceImpl.java @@ -0,0 +1,71 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_0.server; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_9_0.thrift.Account; +import io.opentelemetry.instrumentation.thrift.v0_9_0.thrift.ThriftService; +import io.opentelemetry.instrumentation.thrift.v0_9_0.thrift.User; +import io.opentelemetry.instrumentation.thrift.v0_9_0.thrift.UserAccount; +import java.util.concurrent.TimeUnit; +import org.apache.thrift.TException; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused", "all"}) +public class ThriftServiceImpl implements ThriftService.Iface { + + public ThriftServiceImpl() {} + + @Override + public String sayHello(String zone, String name) { + return "Hello " + zone + "s' " + name; + } + + @Override + public String withDelay(int delay) { + try { + TimeUnit.SECONDS.sleep((long) delay); + } catch (InterruptedException var3) { + InterruptedException e = var3; + throw new VerifyException(e); + } + + return "delay " + delay; + } + + @Override + public String withoutArgs() { + return "no args"; + } + + @Override + public String withError() { + throw new VerifyException("fail"); + } + + @Override + public String withCollisioin(String input) { + return input; + } + + @Override + public void noReturn(int delay) throws TException {} + + @Override + public void oneWayHasArgs(int delay) throws TException {} + + @Override + public void oneWay() {} + + @Override + public void oneWayWithError() { + throw new VerifyException("fail"); + } + + @Override + public UserAccount data(User user, Account account) { + return new UserAccount(user, account); + } +} diff --git a/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/thrift/Account.java b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/thrift/Account.java new file mode 100644 index 000000000000..72da14700479 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/thrift/Account.java @@ -0,0 +1,472 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_0.thrift; + +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; +import org.apache.thrift.TException; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "all"}) +public class Account + implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("Account"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField CARD_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "cardId", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new AccountStandardSchemeFactory()); + schemes.put(TupleScheme.class, new AccountTupleSchemeFactory()); + } + + public String zone; // required + public String cardId; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + CARD_ID((short) 2, "cardId"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // CARD_ID + return CARD_ID; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.CARD_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "cardId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Account.class, metaDataMap); + } + + public Account() {} + + public Account(String zone, String cardId) { + this(); + this.zone = zone; + this.cardId = cardId; + } + + /** Performs a deep copy on other. */ + public Account(Account other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetCardId()) { + this.cardId = other.cardId; + } + } + + public Account deepCopy() { + return new Account(this); + } + + @Override + public void clear() { + this.zone = null; + this.cardId = null; + } + + public String getZone() { + return this.zone; + } + + public Account setZone(String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + public String getCardId() { + return this.cardId; + } + + public Account setCardId(String cardId) { + this.cardId = cardId; + return this; + } + + public void unsetCardId() { + this.cardId = null; + } + + /** Returns true if field cardId is set (has been assigned a value) and false otherwise */ + public boolean isSetCardId() { + return this.cardId != null; + } + + public void setCardIdIsSet(boolean value) { + if (!value) { + this.cardId = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((String) value); + } + break; + + case CARD_ID: + if (value == null) { + unsetCardId(); + } else { + setCardId((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case CARD_ID: + return getCardId(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case CARD_ID: + return isSetCardId(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof Account) return this.equals((Account) that); + return false; + } + + public boolean equals(Account that) { + if (that == null) return false; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_cardId = true && this.isSetCardId(); + boolean that_present_cardId = true && that.isSetCardId(); + if (this_present_cardId || that_present_cardId) { + if (!(this_present_cardId && that_present_cardId)) return false; + if (!this.cardId.equals(that.cardId)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(Account other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + Account typedOther = (Account) other; + + lastComparison = Boolean.valueOf(isSetZone()).compareTo(typedOther.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, typedOther.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetCardId()).compareTo(typedOther.isSetCardId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCardId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cardId, typedOther.cardId); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("Account("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("cardId:"); + if (this.cardId == null) { + sb.append("null"); + } else { + sb.append(this.cardId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + if (zone == null) { + throw new TProtocolException("Required field 'zone' was not present! Struct: " + toString()); + } + if (cardId == null) { + throw new TProtocolException( + "Required field 'cardId' was not present! Struct: " + toString()); + } + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class AccountStandardSchemeFactory implements SchemeFactory { + public AccountStandardScheme getScheme() { + return new AccountStandardScheme(); + } + } + + private static class AccountStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, Account struct) throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // CARD_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, Account struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.cardId != null) { + oprot.writeFieldBegin(CARD_ID_FIELD_DESC); + oprot.writeString(struct.cardId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class AccountTupleSchemeFactory implements SchemeFactory { + public AccountTupleScheme getScheme() { + return new AccountTupleScheme(); + } + } + + private static class AccountTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Account struct) throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeString(struct.zone); + oprot.writeString(struct.cardId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Account struct) throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/thrift/ThriftService.java b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/thrift/ThriftService.java new file mode 100644 index 000000000000..d22006b296e2 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/thrift/ThriftService.java @@ -0,0 +1,6927 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_0.thrift; + +import java.util.BitSet; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "all"}) +public class ThriftService { + + public interface Iface { + + public String sayHello(String zone, String name) throws TException; + + public String withDelay(int delay) throws TException; + + public String withoutArgs() throws TException; + + public String withError() throws TException; + + public String withCollisioin(String input) throws TException; + + public void noReturn(int delay) throws TException; + + public void oneWayHasArgs(int delay) throws TException; + + public void oneWay() throws TException; + + public void oneWayWithError() throws TException; + + public UserAccount data(User user, Account account) throws TException; + } + + public interface AsyncIface { + + public void sayHello( + String zone, + String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException; + + public void withDelay( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException; + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException; + + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException; + + public void withCollisioin( + String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException; + + public void noReturn( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException; + + public void oneWayHasArgs( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException; + + public void oneWay( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException; + + public void oneWayWithError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException; + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException; + } + + public static class Client extends org.apache.thrift.TServiceClient implements Iface { + public static class Factory implements org.apache.thrift.TServiceClientFactory { + public Factory() {} + + public Client getClient(org.apache.thrift.protocol.TProtocol prot) { + return new Client(prot); + } + + public Client getClient( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + return new Client(iprot, oprot); + } + } + + public Client(org.apache.thrift.protocol.TProtocol prot) { + super(prot, prot); + } + + public Client( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + super(iprot, oprot); + } + + public String sayHello(String zone, String name) throws TException { + send_sayHello(zone, name); + return recv_sayHello(); + } + + public void send_sayHello(String zone, String name) throws TException { + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + sendBase("sayHello", args); + } + + public String recv_sayHello() throws TException { + sayHello_result result = new sayHello_result(); + receiveBase(result, "sayHello"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "sayHello failed: unknown result"); + } + + public String withDelay(int delay) throws TException { + send_withDelay(delay); + return recv_withDelay(); + } + + public void send_withDelay(int delay) throws TException { + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + sendBase("withDelay", args); + } + + public String recv_withDelay() throws TException { + withDelay_result result = new withDelay_result(); + receiveBase(result, "withDelay"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withDelay failed: unknown result"); + } + + public String withoutArgs() throws TException { + send_withoutArgs(); + return recv_withoutArgs(); + } + + public void send_withoutArgs() throws TException { + withoutArgs_args args = new withoutArgs_args(); + sendBase("withoutArgs", args); + } + + public String recv_withoutArgs() throws TException { + withoutArgs_result result = new withoutArgs_result(); + receiveBase(result, "withoutArgs"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withoutArgs failed: unknown result"); + } + + public String withError() throws TException { + send_withError(); + return recv_withError(); + } + + public void send_withError() throws TException { + withError_args args = new withError_args(); + sendBase("withError", args); + } + + public String recv_withError() throws TException { + withError_result result = new withError_result(); + receiveBase(result, "withError"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withError failed: unknown result"); + } + + public String withCollisioin(String input) throws TException { + send_withCollisioin(input); + return recv_withCollisioin(); + } + + public void send_withCollisioin(String input) throws TException { + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + sendBase("withCollisioin", args); + } + + public String recv_withCollisioin() throws TException { + withCollisioin_result result = new withCollisioin_result(); + receiveBase(result, "withCollisioin"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withCollisioin failed: unknown result"); + } + + public void noReturn(int delay) throws TException { + send_noReturn(delay); + recv_noReturn(); + } + + public void send_noReturn(int delay) throws TException { + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + sendBase("noReturn", args); + } + + public void recv_noReturn() throws TException { + noReturn_result result = new noReturn_result(); + receiveBase(result, "noReturn"); + return; + } + + public void oneWayHasArgs(int delay) throws TException { + send_oneWayHasArgs(delay); + } + + public void send_oneWayHasArgs(int delay) throws TException { + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + sendBase("oneWayHasArgs", args); + } + + public void oneWay() throws TException { + send_oneWay(); + } + + public void send_oneWay() throws TException { + oneWay_args args = new oneWay_args(); + sendBase("oneWay", args); + } + + public void oneWayWithError() throws TException { + send_oneWayWithError(); + } + + public void send_oneWayWithError() throws TException { + oneWayWithError_args args = new oneWayWithError_args(); + sendBase("oneWayWithError", args); + } + + public UserAccount data(User user, Account account) throws TException { + send_data(user, account); + return recv_data(); + } + + public void send_data(User user, Account account) throws TException { + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + sendBase("data", args); + } + + public UserAccount recv_data() throws TException { + data_result result = new data_result(); + receiveBase(result, "data"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, "data failed: unknown result"); + } + } + + public static class AsyncClient extends org.apache.thrift.async.TAsyncClient + implements AsyncIface { + public static class Factory + implements org.apache.thrift.async.TAsyncClientFactory { + private org.apache.thrift.async.TAsyncClientManager clientManager; + private org.apache.thrift.protocol.TProtocolFactory protocolFactory; + + public Factory( + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.protocol.TProtocolFactory protocolFactory) { + this.clientManager = clientManager; + this.protocolFactory = protocolFactory; + } + + public AsyncClient getAsyncClient( + org.apache.thrift.transport.TNonblockingTransport transport) { + return new AsyncClient(protocolFactory, clientManager, transport); + } + } + + public AsyncClient( + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.transport.TNonblockingTransport transport) { + super(protocolFactory, clientManager, transport); + } + + public void sayHello( + String zone, + String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + checkReady(); + sayHello_call method_call = + new sayHello_call(zone, name, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class sayHello_call extends org.apache.thrift.async.TAsyncMethodCall { + private String zone; + private String name; + + public sayHello_call( + String zone, + String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + this.zone = zone; + this.name = name; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "sayHello", org.apache.thrift.protocol.TMessageType.CALL, 0)); + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_sayHello(); + } + } + + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + checkReady(); + withDelay_call method_call = + new withDelay_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withDelay_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public withDelay_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withDelay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withDelay(); + } + } + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + checkReady(); + withoutArgs_call method_call = + new withoutArgs_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withoutArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + public withoutArgs_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withoutArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withoutArgs_args args = new withoutArgs_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withoutArgs(); + } + } + + public void withError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + checkReady(); + withError_call method_call = + new withError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withError_call extends org.apache.thrift.async.TAsyncMethodCall { + public withError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withError_args args = new withError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withError(); + } + } + + public void withCollisioin( + String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + checkReady(); + withCollisioin_call method_call = + new withCollisioin_call(input, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withCollisioin_call extends org.apache.thrift.async.TAsyncMethodCall { + private String input; + + public withCollisioin_call( + String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + this.input = input; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withCollisioin", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withCollisioin(); + } + } + + public void noReturn( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + checkReady(); + noReturn_call method_call = + new noReturn_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class noReturn_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public noReturn_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "noReturn", org.apache.thrift.protocol.TMessageType.CALL, 0)); + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + (new Client(prot)).recv_noReturn(); + } + } + + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + checkReady(); + oneWayHasArgs_call method_call = + new oneWayHasArgs_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayHasArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public oneWayHasArgs_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, true); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayHasArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + checkReady(); + oneWay_call method_call = + new oneWay_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWay_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWay_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + oneWay_args args = new oneWay_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void oneWayWithError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + checkReady(); + oneWayWithError_call method_call = + new oneWayWithError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayWithError_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWayWithError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayWithError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + oneWayWithError_args args = new oneWayWithError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + checkReady(); + data_call method_call = + new data_call(user, account, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class data_call extends org.apache.thrift.async.TAsyncMethodCall { + private User user; + private Account account; + + public data_call( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + this.user = user; + this.account = account; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "data", org.apache.thrift.protocol.TMessageType.CALL, 0)); + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + args.write(prot); + prot.writeMessageEnd(); + } + + public UserAccount getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_data(); + } + } + } + + public static class Processor extends org.apache.thrift.TBaseProcessor + implements org.apache.thrift.TProcessor { + private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); + + public Processor(I iface) { + super( + iface, + getProcessMap( + new HashMap< + String, + org.apache.thrift.ProcessFunction>())); + } + + protected Processor( + I iface, + Map> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + Map> + getProcessMap( + Map> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.ProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + protected boolean isOneway() { + return false; + } + + public sayHello_result getResult(I iface, sayHello_args args) throws TException { + sayHello_result result = new sayHello_result(); + result.success = iface.sayHello(args.zone, args.name); + return result; + } + } + + public static class withDelay + extends org.apache.thrift.ProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + protected boolean isOneway() { + return false; + } + + public withDelay_result getResult(I iface, withDelay_args args) throws TException { + withDelay_result result = new withDelay_result(); + result.success = iface.withDelay(args.delay); + return result; + } + } + + public static class withoutArgs + extends org.apache.thrift.ProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + protected boolean isOneway() { + return false; + } + + public withoutArgs_result getResult(I iface, withoutArgs_args args) throws TException { + withoutArgs_result result = new withoutArgs_result(); + result.success = iface.withoutArgs(); + return result; + } + } + + public static class withError + extends org.apache.thrift.ProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + protected boolean isOneway() { + return false; + } + + public withError_result getResult(I iface, withError_args args) throws TException { + withError_result result = new withError_result(); + result.success = iface.withError(); + return result; + } + } + + public static class withCollisioin + extends org.apache.thrift.ProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + protected boolean isOneway() { + return false; + } + + public withCollisioin_result getResult(I iface, withCollisioin_args args) throws TException { + withCollisioin_result result = new withCollisioin_result(); + result.success = iface.withCollisioin(args.input); + return result; + } + } + + public static class noReturn + extends org.apache.thrift.ProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + protected boolean isOneway() { + return false; + } + + public noReturn_result getResult(I iface, noReturn_args args) throws TException { + noReturn_result result = new noReturn_result(); + iface.noReturn(args.delay); + return result; + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.ProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + protected boolean isOneway() { + return true; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayHasArgs_args args) throws TException { + iface.oneWayHasArgs(args.delay); + return null; + } + } + + public static class oneWay + extends org.apache.thrift.ProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + protected boolean isOneway() { + return true; + } + + public org.apache.thrift.TBase getResult(I iface, oneWay_args args) throws TException { + iface.oneWay(); + return null; + } + } + + public static class oneWayWithError + extends org.apache.thrift.ProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + protected boolean isOneway() { + return true; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayWithError_args args) + throws TException { + iface.oneWayWithError(); + return null; + } + } + + public static class data + extends org.apache.thrift.ProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + protected boolean isOneway() { + return false; + } + + public data_result getResult(I iface, data_args args) throws TException { + data_result result = new data_result(); + result.success = iface.data(args.user, args.account); + return result; + } + } + } + + public static class sayHello_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_args"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new sayHello_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new sayHello_argsTupleSchemeFactory()); + } + + public String zone; // required + public String name; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + NAME((short) 2, "name"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // NAME + return NAME; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_args.class, metaDataMap); + } + + public sayHello_args() {} + + public sayHello_args(String zone, String name) { + this(); + this.zone = zone; + this.name = name; + } + + /** Performs a deep copy on other. */ + public sayHello_args(sayHello_args other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetName()) { + this.name = other.name; + } + } + + public sayHello_args deepCopy() { + return new sayHello_args(this); + } + + @Override + public void clear() { + this.zone = null; + this.name = null; + } + + public String getZone() { + return this.zone; + } + + public sayHello_args setZone(String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + public String getName() { + return this.name; + } + + public sayHello_args setName(String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((String) value); + } + break; + + case NAME: + if (value == null) { + unsetName(); + } else { + setName((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case NAME: + return getName(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case NAME: + return isSetName(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof sayHello_args) return this.equals((sayHello_args) that); + return false; + } + + public boolean equals(sayHello_args that) { + if (that == null) return false; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(sayHello_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + sayHello_args typedOther = (sayHello_args) other; + + lastComparison = Boolean.valueOf(isSetZone()).compareTo(typedOther.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, typedOther.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetName()).compareTo(typedOther.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, typedOther.name); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("sayHello_args("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_argsStandardSchemeFactory implements SchemeFactory { + public sayHello_argsStandardScheme getScheme() { + return new sayHello_argsStandardScheme(); + } + } + + private static class sayHello_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_argsTupleSchemeFactory implements SchemeFactory { + public sayHello_argsTupleScheme getScheme() { + return new sayHello_argsTupleScheme(); + } + } + + private static class sayHello_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetZone()) { + optionals.set(0); + } + if (struct.isSetName()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetZone()) { + oprot.writeString(struct.zone); + } + if (struct.isSetName()) { + oprot.writeString(struct.name); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } + if (incoming.get(1)) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } + } + } + } + + public static class sayHello_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new sayHello_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new sayHello_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_result.class, metaDataMap); + } + + public sayHello_result() {} + + public sayHello_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public sayHello_result(sayHello_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public sayHello_result deepCopy() { + return new sayHello_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public sayHello_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof sayHello_result) return this.equals((sayHello_result) that); + return false; + } + + public boolean equals(sayHello_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(sayHello_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + sayHello_result typedOther = (sayHello_result) other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("sayHello_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_resultStandardSchemeFactory implements SchemeFactory { + public sayHello_resultStandardScheme getScheme() { + return new sayHello_resultStandardScheme(); + } + } + + private static class sayHello_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_resultTupleSchemeFactory implements SchemeFactory { + public sayHello_resultTupleScheme getScheme() { + return new sayHello_resultTupleScheme(); + } + } + + private static class sayHello_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withDelay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withDelay_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withDelay_argsTupleSchemeFactory()); + } + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_args.class, metaDataMap); + } + + public withDelay_args() {} + + public withDelay_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public withDelay_args(withDelay_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public withDelay_args deepCopy() { + return new withDelay_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public withDelay_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return Integer.valueOf(getDelay()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withDelay_args) return this.equals((withDelay_args) that); + return false; + } + + public boolean equals(withDelay_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withDelay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withDelay_args typedOther = (withDelay_args) other; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(typedOther.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, typedOther.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withDelay_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_argsStandardSchemeFactory implements SchemeFactory { + public withDelay_argsStandardScheme getScheme() { + return new withDelay_argsStandardScheme(); + } + } + + private static class withDelay_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_argsTupleSchemeFactory implements SchemeFactory { + public withDelay_argsTupleScheme getScheme() { + return new withDelay_argsTupleScheme(); + } + } + + private static class withDelay_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + } + + public static class withDelay_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withDelay_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withDelay_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_result.class, metaDataMap); + } + + public withDelay_result() {} + + public withDelay_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withDelay_result(withDelay_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withDelay_result deepCopy() { + return new withDelay_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withDelay_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withDelay_result) return this.equals((withDelay_result) that); + return false; + } + + public boolean equals(withDelay_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withDelay_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withDelay_result typedOther = (withDelay_result) other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withDelay_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_resultStandardSchemeFactory implements SchemeFactory { + public withDelay_resultStandardScheme getScheme() { + return new withDelay_resultStandardScheme(); + } + } + + private static class withDelay_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_resultTupleSchemeFactory implements SchemeFactory { + public withDelay_resultTupleScheme getScheme() { + return new withDelay_resultTupleScheme(); + } + } + + private static class withDelay_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withoutArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withoutArgs_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withoutArgs_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_args.class, metaDataMap); + } + + public withoutArgs_args() {} + + /** Performs a deep copy on other. */ + public withoutArgs_args(withoutArgs_args other) {} + + public withoutArgs_args deepCopy() { + return new withoutArgs_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withoutArgs_args) return this.equals((withoutArgs_args) that); + return false; + } + + public boolean equals(withoutArgs_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withoutArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withoutArgs_args typedOther = (withoutArgs_args) other; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withoutArgs_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_argsStandardSchemeFactory implements SchemeFactory { + public withoutArgs_argsStandardScheme getScheme() { + return new withoutArgs_argsStandardScheme(); + } + } + + private static class withoutArgs_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_argsTupleSchemeFactory implements SchemeFactory { + public withoutArgs_argsTupleScheme getScheme() { + return new withoutArgs_argsTupleScheme(); + } + } + + private static class withoutArgs_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class withoutArgs_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withoutArgs_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withoutArgs_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_result.class, metaDataMap); + } + + public withoutArgs_result() {} + + public withoutArgs_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withoutArgs_result(withoutArgs_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withoutArgs_result deepCopy() { + return new withoutArgs_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withoutArgs_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withoutArgs_result) return this.equals((withoutArgs_result) that); + return false; + } + + public boolean equals(withoutArgs_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withoutArgs_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withoutArgs_result typedOther = (withoutArgs_result) other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withoutArgs_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_resultStandardSchemeFactory implements SchemeFactory { + public withoutArgs_resultStandardScheme getScheme() { + return new withoutArgs_resultStandardScheme(); + } + } + + private static class withoutArgs_resultStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_resultTupleSchemeFactory implements SchemeFactory { + public withoutArgs_resultTupleScheme getScheme() { + return new withoutArgs_resultTupleScheme(); + } + } + + private static class withoutArgs_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withError_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withError_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_args.class, metaDataMap); + } + + public withError_args() {} + + /** Performs a deep copy on other. */ + public withError_args(withError_args other) {} + + public withError_args deepCopy() { + return new withError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withError_args) return this.equals((withError_args) that); + return false; + } + + public boolean equals(withError_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withError_args typedOther = (withError_args) other; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_argsStandardSchemeFactory implements SchemeFactory { + public withError_argsStandardScheme getScheme() { + return new withError_argsStandardScheme(); + } + } + + private static class withError_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_argsTupleSchemeFactory implements SchemeFactory { + public withError_argsTupleScheme getScheme() { + return new withError_argsTupleScheme(); + } + } + + private static class withError_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class withError_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withError_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withError_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_result.class, metaDataMap); + } + + public withError_result() {} + + public withError_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withError_result(withError_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withError_result deepCopy() { + return new withError_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withError_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withError_result) return this.equals((withError_result) that); + return false; + } + + public boolean equals(withError_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withError_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withError_result typedOther = (withError_result) other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withError_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_resultStandardSchemeFactory implements SchemeFactory { + public withError_resultStandardScheme getScheme() { + return new withError_resultStandardScheme(); + } + } + + private static class withError_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_resultTupleSchemeFactory implements SchemeFactory { + public withError_resultTupleScheme getScheme() { + return new withError_resultTupleScheme(); + } + } + + private static class withError_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withCollisioin_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_args"); + + private static final org.apache.thrift.protocol.TField INPUT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "input", org.apache.thrift.protocol.TType.STRING, (short) 3333); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withCollisioin_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withCollisioin_argsTupleSchemeFactory()); + } + + public String input; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + INPUT((short) 3333, "input"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 3333: // INPUT + return INPUT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.INPUT, + new org.apache.thrift.meta_data.FieldMetaData( + "input", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_args.class, metaDataMap); + } + + public withCollisioin_args() {} + + public withCollisioin_args(String input) { + this(); + this.input = input; + } + + /** Performs a deep copy on other. */ + public withCollisioin_args(withCollisioin_args other) { + if (other.isSetInput()) { + this.input = other.input; + } + } + + public withCollisioin_args deepCopy() { + return new withCollisioin_args(this); + } + + @Override + public void clear() { + this.input = null; + } + + public String getInput() { + return this.input; + } + + public withCollisioin_args setInput(String input) { + this.input = input; + return this; + } + + public void unsetInput() { + this.input = null; + } + + /** Returns true if field input is set (has been assigned a value) and false otherwise */ + public boolean isSetInput() { + return this.input != null; + } + + public void setInputIsSet(boolean value) { + if (!value) { + this.input = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case INPUT: + if (value == null) { + unsetInput(); + } else { + setInput((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case INPUT: + return getInput(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case INPUT: + return isSetInput(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withCollisioin_args) return this.equals((withCollisioin_args) that); + return false; + } + + public boolean equals(withCollisioin_args that) { + if (that == null) return false; + + boolean this_present_input = true && this.isSetInput(); + boolean that_present_input = true && that.isSetInput(); + if (this_present_input || that_present_input) { + if (!(this_present_input && that_present_input)) return false; + if (!this.input.equals(that.input)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withCollisioin_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withCollisioin_args typedOther = (withCollisioin_args) other; + + lastComparison = Boolean.valueOf(isSetInput()).compareTo(typedOther.isSetInput()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInput()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.input, typedOther.input); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withCollisioin_args("); + boolean first = true; + + sb.append("input:"); + if (this.input == null) { + sb.append("null"); + } else { + sb.append(this.input); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_argsStandardSchemeFactory implements SchemeFactory { + public withCollisioin_argsStandardScheme getScheme() { + return new withCollisioin_argsStandardScheme(); + } + } + + private static class withCollisioin_argsStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 3333: // INPUT + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.input != null) { + oprot.writeFieldBegin(INPUT_FIELD_DESC); + oprot.writeString(struct.input); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_argsTupleSchemeFactory implements SchemeFactory { + public withCollisioin_argsTupleScheme getScheme() { + return new withCollisioin_argsTupleScheme(); + } + } + + private static class withCollisioin_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetInput()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetInput()) { + oprot.writeString(struct.input); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } + } + } + } + + public static class withCollisioin_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withCollisioin_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withCollisioin_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_result.class, metaDataMap); + } + + public withCollisioin_result() {} + + public withCollisioin_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withCollisioin_result(withCollisioin_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withCollisioin_result deepCopy() { + return new withCollisioin_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withCollisioin_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withCollisioin_result) return this.equals((withCollisioin_result) that); + return false; + } + + public boolean equals(withCollisioin_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withCollisioin_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withCollisioin_result typedOther = (withCollisioin_result) other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withCollisioin_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_resultStandardSchemeFactory implements SchemeFactory { + public withCollisioin_resultStandardScheme getScheme() { + return new withCollisioin_resultStandardScheme(); + } + } + + private static class withCollisioin_resultStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_resultTupleSchemeFactory implements SchemeFactory { + public withCollisioin_resultTupleScheme getScheme() { + return new withCollisioin_resultTupleScheme(); + } + } + + private static class withCollisioin_resultTupleScheme + extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class noReturn_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new noReturn_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new noReturn_argsTupleSchemeFactory()); + } + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_args.class, metaDataMap); + } + + public noReturn_args() {} + + public noReturn_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public noReturn_args(noReturn_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public noReturn_args deepCopy() { + return new noReturn_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public noReturn_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return Integer.valueOf(getDelay()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof noReturn_args) return this.equals((noReturn_args) that); + return false; + } + + public boolean equals(noReturn_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(noReturn_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + noReturn_args typedOther = (noReturn_args) other; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(typedOther.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, typedOther.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("noReturn_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_argsStandardSchemeFactory implements SchemeFactory { + public noReturn_argsStandardScheme getScheme() { + return new noReturn_argsStandardScheme(); + } + } + + private static class noReturn_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_argsTupleSchemeFactory implements SchemeFactory { + public noReturn_argsTupleScheme getScheme() { + return new noReturn_argsTupleScheme(); + } + } + + private static class noReturn_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + } + + public static class noReturn_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_result"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new noReturn_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new noReturn_resultTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_result.class, metaDataMap); + } + + public noReturn_result() {} + + /** Performs a deep copy on other. */ + public noReturn_result(noReturn_result other) {} + + public noReturn_result deepCopy() { + return new noReturn_result(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof noReturn_result) return this.equals((noReturn_result) that); + return false; + } + + public boolean equals(noReturn_result that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(noReturn_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + noReturn_result typedOther = (noReturn_result) other; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("noReturn_result("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_resultStandardSchemeFactory implements SchemeFactory { + public noReturn_resultStandardScheme getScheme() { + return new noReturn_resultStandardScheme(); + } + } + + private static class noReturn_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_resultTupleSchemeFactory implements SchemeFactory { + public noReturn_resultTupleScheme getScheme() { + return new noReturn_resultTupleScheme(); + } + } + + private static class noReturn_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class oneWayHasArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayHasArgs_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new oneWayHasArgs_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new oneWayHasArgs_argsTupleSchemeFactory()); + } + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayHasArgs_args.class, metaDataMap); + } + + public oneWayHasArgs_args() {} + + public oneWayHasArgs_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public oneWayHasArgs_args(oneWayHasArgs_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public oneWayHasArgs_args deepCopy() { + return new oneWayHasArgs_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public oneWayHasArgs_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return Integer.valueOf(getDelay()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWayHasArgs_args) return this.equals((oneWayHasArgs_args) that); + return false; + } + + public boolean equals(oneWayHasArgs_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(oneWayHasArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + oneWayHasArgs_args typedOther = (oneWayHasArgs_args) other; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(typedOther.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, typedOther.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWayHasArgs_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayHasArgs_argsStandardSchemeFactory implements SchemeFactory { + public oneWayHasArgs_argsStandardScheme getScheme() { + return new oneWayHasArgs_argsStandardScheme(); + } + } + + private static class oneWayHasArgs_argsStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayHasArgs_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayHasArgs_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayHasArgs_argsTupleSchemeFactory implements SchemeFactory { + public oneWayHasArgs_argsTupleScheme getScheme() { + return new oneWayHasArgs_argsTupleScheme(); + } + } + + private static class oneWayHasArgs_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + } + + public static class oneWay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWay_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new oneWay_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new oneWay_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWay_args.class, metaDataMap); + } + + public oneWay_args() {} + + /** Performs a deep copy on other. */ + public oneWay_args(oneWay_args other) {} + + public oneWay_args deepCopy() { + return new oneWay_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWay_args) return this.equals((oneWay_args) that); + return false; + } + + public boolean equals(oneWay_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(oneWay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + oneWay_args typedOther = (oneWay_args) other; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWay_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWay_argsStandardSchemeFactory implements SchemeFactory { + public oneWay_argsStandardScheme getScheme() { + return new oneWay_argsStandardScheme(); + } + } + + private static class oneWay_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWay_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWay_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWay_argsTupleSchemeFactory implements SchemeFactory { + public oneWay_argsTupleScheme getScheme() { + return new oneWay_argsTupleScheme(); + } + } + + private static class oneWay_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class oneWayWithError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayWithError_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new oneWayWithError_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new oneWayWithError_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayWithError_args.class, metaDataMap); + } + + public oneWayWithError_args() {} + + /** Performs a deep copy on other. */ + public oneWayWithError_args(oneWayWithError_args other) {} + + public oneWayWithError_args deepCopy() { + return new oneWayWithError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWayWithError_args) return this.equals((oneWayWithError_args) that); + return false; + } + + public boolean equals(oneWayWithError_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(oneWayWithError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + oneWayWithError_args typedOther = (oneWayWithError_args) other; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWayWithError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayWithError_argsStandardSchemeFactory implements SchemeFactory { + public oneWayWithError_argsStandardScheme getScheme() { + return new oneWayWithError_argsStandardScheme(); + } + } + + private static class oneWayWithError_argsStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayWithError_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayWithError_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayWithError_argsTupleSchemeFactory implements SchemeFactory { + public oneWayWithError_argsTupleScheme getScheme() { + return new oneWayWithError_argsTupleScheme(); + } + } + + private static class oneWayWithError_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class data_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_args"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new data_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new data_argsTupleSchemeFactory()); + } + + public User user; // required + public Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(data_args.class, metaDataMap); + } + + public data_args() {} + + public data_args(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public data_args(data_args other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public data_args deepCopy() { + return new data_args(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + public User getUser() { + return this.user; + } + + public data_args setUser(User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + public Account getAccount() { + return this.account; + } + + public data_args setAccount(Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof data_args) return this.equals((data_args) that); + return false; + } + + public boolean equals(data_args that) { + if (that == null) return false; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(data_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + data_args typedOther = (data_args) other; + + lastComparison = Boolean.valueOf(isSetUser()).compareTo(typedOther.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, typedOther.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAccount()).compareTo(typedOther.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, typedOther.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("data_args("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_argsStandardSchemeFactory implements SchemeFactory { + public data_argsStandardScheme getScheme() { + return new data_argsStandardScheme(); + } + } + + private static class data_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_argsTupleSchemeFactory implements SchemeFactory { + public data_argsTupleScheme getScheme() { + return new data_argsTupleScheme(); + } + } + + private static class data_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetUser()) { + optionals.set(0); + } + if (struct.isSetAccount()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetUser()) { + struct.user.write(oprot); + } + if (struct.isSetAccount()) { + struct.account.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } + if (incoming.get(1)) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + } + } + + public static class data_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRUCT, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new data_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new data_resultTupleSchemeFactory()); + } + + public UserAccount success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, UserAccount.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + data_result.class, metaDataMap); + } + + public data_result() {} + + public data_result(UserAccount success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public data_result(data_result other) { + if (other.isSetSuccess()) { + this.success = new UserAccount(other.success); + } + } + + public data_result deepCopy() { + return new data_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public UserAccount getSuccess() { + return this.success; + } + + public data_result setSuccess(UserAccount success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((UserAccount) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof data_result) return this.equals((data_result) that); + return false; + } + + public boolean equals(data_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(data_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + data_result typedOther = (data_result) other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("data_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_resultStandardSchemeFactory implements SchemeFactory { + public data_resultStandardScheme getScheme() { + return new data_resultStandardScheme(); + } + } + + private static class data_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_resultTupleSchemeFactory implements SchemeFactory { + public data_resultTupleScheme getScheme() { + return new data_resultTupleScheme(); + } + } + + private static class data_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/thrift/User.java b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/thrift/User.java new file mode 100644 index 000000000000..4fcfa13be398 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/thrift/User.java @@ -0,0 +1,572 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_0.thrift; + +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "all"}) +public class User + implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("User"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "userId", org.apache.thrift.protocol.TType.STRING, (short) 2); + private static final org.apache.thrift.protocol.TField AGE_FIELD_DESC = + new org.apache.thrift.protocol.TField("age", org.apache.thrift.protocol.TType.I32, (short) 3); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new UserStandardSchemeFactory()); + schemes.put(TupleScheme.class, new UserTupleSchemeFactory()); + } + + public String name; // required + public String userId; // required + public int age; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + NAME((short) 1, "name"), + USER_ID((short) 2, "userId"), + AGE((short) 3, "age"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // NAME + return NAME; + case 2: // USER_ID + return USER_ID; + case 3: // AGE + return AGE; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __AGE_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.USER_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "userId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.AGE, + new org.apache.thrift.meta_data.FieldMetaData( + "age", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(User.class, metaDataMap); + } + + public User() {} + + public User(String name, String userId, int age) { + this(); + this.name = name; + this.userId = userId; + this.age = age; + setAgeIsSet(true); + } + + /** Performs a deep copy on other. */ + public User(User other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetName()) { + this.name = other.name; + } + if (other.isSetUserId()) { + this.userId = other.userId; + } + this.age = other.age; + } + + public User deepCopy() { + return new User(this); + } + + @Override + public void clear() { + this.name = null; + this.userId = null; + setAgeIsSet(false); + this.age = 0; + } + + public String getName() { + return this.name; + } + + public User setName(String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public String getUserId() { + return this.userId; + } + + public User setUserId(String userId) { + this.userId = userId; + return this; + } + + public void unsetUserId() { + this.userId = null; + } + + /** Returns true if field userId is set (has been assigned a value) and false otherwise */ + public boolean isSetUserId() { + return this.userId != null; + } + + public void setUserIdIsSet(boolean value) { + if (!value) { + this.userId = null; + } + } + + public int getAge() { + return this.age; + } + + public User setAge(int age) { + this.age = age; + setAgeIsSet(true); + return this; + } + + public void unsetAge() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __AGE_ISSET_ID); + } + + /** Returns true if field age is set (has been assigned a value) and false otherwise */ + public boolean isSetAge() { + return EncodingUtils.testBit(__isset_bitfield, __AGE_ISSET_ID); + } + + public void setAgeIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __AGE_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case NAME: + if (value == null) { + unsetName(); + } else { + setName((String) value); + } + break; + + case USER_ID: + if (value == null) { + unsetUserId(); + } else { + setUserId((String) value); + } + break; + + case AGE: + if (value == null) { + unsetAge(); + } else { + setAge((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case NAME: + return getName(); + + case USER_ID: + return getUserId(); + + case AGE: + return Integer.valueOf(getAge()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case NAME: + return isSetName(); + case USER_ID: + return isSetUserId(); + case AGE: + return isSetAge(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof User) return this.equals((User) that); + return false; + } + + public boolean equals(User that) { + if (that == null) return false; + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + boolean this_present_userId = true && this.isSetUserId(); + boolean that_present_userId = true && that.isSetUserId(); + if (this_present_userId || that_present_userId) { + if (!(this_present_userId && that_present_userId)) return false; + if (!this.userId.equals(that.userId)) return false; + } + + boolean this_present_age = true; + boolean that_present_age = true; + if (this_present_age || that_present_age) { + if (!(this_present_age && that_present_age)) return false; + if (this.age != that.age) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(User other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + User typedOther = (User) other; + + lastComparison = Boolean.valueOf(isSetName()).compareTo(typedOther.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, typedOther.name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetUserId()).compareTo(typedOther.isSetUserId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, typedOther.userId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAge()).compareTo(typedOther.isSetAge()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAge()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.age, typedOther.age); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("User("); + boolean first = true; + + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + if (!first) sb.append(", "); + sb.append("userId:"); + if (this.userId == null) { + sb.append("null"); + } else { + sb.append(this.userId); + } + first = false; + if (!first) sb.append(", "); + sb.append("age:"); + sb.append(this.age); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + if (name == null) { + throw new TProtocolException("Required field 'name' was not present! Struct: " + toString()); + } + if (userId == null) { + throw new TProtocolException( + "Required field 'userId' was not present! Struct: " + toString()); + } + // alas, we cannot check 'age' because it's a primitive and you chose the non-beans generator. + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserStandardSchemeFactory implements SchemeFactory { + public UserStandardScheme getScheme() { + return new UserStandardScheme(); + } + } + + private static class UserStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, User struct) throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // AGE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + if (!struct.isSetAge()) { + throw new TProtocolException( + "Required field 'age' was not found in serialized data! Struct: " + toString()); + } + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, User struct) throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + if (struct.userId != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userId); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(AGE_FIELD_DESC); + oprot.writeI32(struct.age); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserTupleSchemeFactory implements SchemeFactory { + public UserTupleScheme getScheme() { + return new UserTupleScheme(); + } + } + + private static class UserTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, User struct) throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeString(struct.name); + oprot.writeString(struct.userId); + oprot.writeI32(struct.age); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, User struct) throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.name = iprot.readString(); + struct.setNameIsSet(true); + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/thrift/UserAccount.java b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/thrift/UserAccount.java new file mode 100644 index 000000000000..5641e4ddf467 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.0-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_0/thrift/UserAccount.java @@ -0,0 +1,487 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_0.thrift; + +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; +import org.apache.thrift.TException; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "all"}) +public class UserAccount + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("UserAccount"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new UserAccountStandardSchemeFactory()); + schemes.put(TupleScheme.class, new UserAccountTupleSchemeFactory()); + } + + public User user; // required + public Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserAccount.class, metaDataMap); + } + + public UserAccount() {} + + public UserAccount(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public UserAccount(UserAccount other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public UserAccount deepCopy() { + return new UserAccount(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + public User getUser() { + return this.user; + } + + public UserAccount setUser(User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + public Account getAccount() { + return this.account; + } + + public UserAccount setAccount(Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof UserAccount) return this.equals((UserAccount) that); + return false; + } + + public boolean equals(UserAccount that) { + if (that == null) return false; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(UserAccount other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + UserAccount typedOther = (UserAccount) other; + + lastComparison = Boolean.valueOf(isSetUser()).compareTo(typedOther.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, typedOther.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAccount()).compareTo(typedOther.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, typedOther.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("UserAccount("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + if (user == null) { + throw new TProtocolException("Required field 'user' was not present! Struct: " + toString()); + } + if (account == null) { + throw new TProtocolException( + "Required field 'account' was not present! Struct: " + toString()); + } + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserAccountStandardSchemeFactory implements SchemeFactory { + public UserAccountStandardScheme getScheme() { + return new UserAccountStandardScheme(); + } + } + + private static class UserAccountStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, UserAccount struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, UserAccount struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserAccountTupleSchemeFactory implements SchemeFactory { + public UserAccountTupleScheme getScheme() { + return new UserAccountTupleScheme(); + } + } + + private static class UserAccountTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + struct.user.write(oprot); + struct.account.write(oprot); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/build.gradle.kts b/instrumentation/thrift/thrift-0.9.1/javaagent/build.gradle.kts new file mode 100644 index 000000000000..fbb70e456cf8 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/build.gradle.kts @@ -0,0 +1,19 @@ +plugins { + id("otel.javaagent-instrumentation") +} + +muzzle { + pass { + group.set("org.apache.thrift") + module.set("libthrift") + versions.set("[0.9.1,)") + } +} + +dependencies { + compileOnly("org.apache.thrift:libthrift:0.9.1") + implementation(project(":instrumentation:thrift:thrift-common:library")) + + testImplementation("org.apache.thrift:libthrift:0.9.1") + testImplementation("javax.annotation:javax.annotation-api:1.3.2") +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/AbstractProtocolWrapper.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/AbstractProtocolWrapper.java new file mode 100644 index 000000000000..478493322327 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/AbstractProtocolWrapper.java @@ -0,0 +1,22 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1; + +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolDecorator; + +/** + * Note that the 8888th field of record is reserved for transporting trace header. Because Thrift + * doesn't support to transport metadata. + */ +public abstract class AbstractProtocolWrapper extends TProtocolDecorator { + public static final String OT_MAGIC_FIELD = "OT_MAGIC_FIELD"; + public static final short OT_MAGIC_FIELD_ID = 8888; + + public AbstractProtocolWrapper(TProtocol protocol) { + super(protocol); + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/AsyncMethodCallbackWrapper.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/AsyncMethodCallbackWrapper.java new file mode 100644 index 000000000000..cac2a854b3bd --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/AsyncMethodCallbackWrapper.java @@ -0,0 +1,67 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1; + +import static io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.ThriftSingletons.clientInstrumenter; +import static io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.ThriftSingletons.serverInstrumenter; + +import io.opentelemetry.context.Context; +import io.opentelemetry.instrumentation.thrift.common.RequestScopeContext; +import io.opentelemetry.instrumentation.thrift.common.ThriftRequest; +import org.apache.thrift.async.AsyncMethodCallback; + +public final class AsyncMethodCallbackWrapper implements AsyncMethodCallback { + private final AsyncMethodCallback delegate; + private RequestScopeContext requestScopeContext; + private final boolean isServer; + + public AsyncMethodCallbackWrapper(AsyncMethodCallback methodCallback, boolean isServer) { + this.delegate = methodCallback; + this.isServer = isServer; + } + + public void setRequestScopeContext(RequestScopeContext requestScopeContext) { + this.requestScopeContext = requestScopeContext; + } + + @Override + public void onComplete(T t) { + try { + if (this.requestScopeContext == null) { + return; + } + this.requestScopeContext.close(); + Context context = this.requestScopeContext.getContext(); + ThriftRequest request = this.requestScopeContext.getRequest(); + if (isServer) { + serverInstrumenter().end(context, request, 0, null); + } else { + clientInstrumenter().end(context, request, 0, null); + } + } finally { + this.delegate.onComplete(t); + } + } + + @Override + public void onError(Exception e) { + try { + if (this.requestScopeContext == null) { + return; + } + this.requestScopeContext.close(); + Context context = this.requestScopeContext.getContext(); + ThriftRequest request = this.requestScopeContext.getRequest(); + if (isServer) { + serverInstrumenter().end(context, request, 1, e); + } else { + clientInstrumenter().end(context, request, 1, e); + } + } finally { + this.delegate.onError(e); + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/ThriftSingletons.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/ThriftSingletons.java new file mode 100644 index 000000000000..c22dd1b56304 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/ThriftSingletons.java @@ -0,0 +1,29 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1; + +import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; +import io.opentelemetry.instrumentation.thrift.common.ThriftInstrumenterFactory; +import io.opentelemetry.instrumentation.thrift.common.ThriftRequest; + +public final class ThriftSingletons { + private static final String INSTRUMENTATION_NAME = "io.opentelemetry.thrift-0.9.1"; + + private static final Instrumenter CLIENT_INSTRUMENTER = + ThriftInstrumenterFactory.clientInstrumenter(INSTRUMENTATION_NAME); + private static final Instrumenter SERVER_INSTRUMENTER = + ThriftInstrumenterFactory.serverInstrumenter(INSTRUMENTATION_NAME); + + public static Instrumenter clientInstrumenter() { + return CLIENT_INSTRUMENTER; + } + + public static Instrumenter serverInstrumenter() { + return SERVER_INSTRUMENTER; + } + + private ThriftSingletons() {} +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/client/ClientOutProtocolWrapper.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/client/ClientOutProtocolWrapper.java new file mode 100644 index 000000000000..71a73f6f6097 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/client/ClientOutProtocolWrapper.java @@ -0,0 +1,143 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.client; + +import static io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.ThriftSingletons.clientInstrumenter; + +import io.opentelemetry.context.Context; +import io.opentelemetry.instrumentation.thrift.common.RequestScopeContext; +import io.opentelemetry.instrumentation.thrift.common.SocketAccessor; +import io.opentelemetry.instrumentation.thrift.common.ThriftRequest; +import io.opentelemetry.javaagent.bootstrap.Java8BytecodeBridge; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.AbstractProtocolWrapper; +import java.net.Socket; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import org.apache.thrift.TException; +import org.apache.thrift.protocol.TField; +import org.apache.thrift.protocol.TMap; +import org.apache.thrift.protocol.TMessage; +import org.apache.thrift.protocol.TMessageType; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TType; +import org.apache.thrift.transport.TTransport; + +@SuppressWarnings("all") +public final class ClientOutProtocolWrapper extends AbstractProtocolWrapper { + public static final String ONE_WAY_METHOD_NAME_PREFIX = "recv_"; + private volatile RequestScopeContext requestScopeContext; + public TTransport transport; + private boolean injected = true; + private String methodName; + private final Set voidMethodNames; + private String serviceName; + private byte type = -1; + private byte originType; + + public ClientOutProtocolWrapper( + TProtocol protocol, String serviceName, Set voidMethodNames) { + super(protocol); + this.serviceName = serviceName; + this.voidMethodNames = voidMethodNames; + } + + @Override + public void writeMessageBegin(TMessage message) throws TException { + this.injected = false; + this.methodName = message.name; + this.originType = message.type; + // Compatible with version 0.9.1 and 0.9.2 asynchronous logic + if (message.type == TMessageType.ONEWAY || this.type == -1) { + this.type = message.type; + } + if (!this.isOneway()) { + if (this.voidMethodNames != null + && this.voidMethodNames.contains(this.methodName) + && !this.voidMethodNames.contains(ONE_WAY_METHOD_NAME_PREFIX + this.methodName)) { + this.type = TMessageType.ONEWAY; + } + } + try { + if (this.requestScopeContext == null) { + Socket socket = SocketAccessor.getSocket(super.getTransport()); + if (socket == null) { + socket = SocketAccessor.getSocket(this.transport); + } + ThriftRequest request = + ThriftRequest.create(this.serviceName, this.methodName, socket, new HashMap<>()); + Context parentContext = Java8BytecodeBridge.currentContext(); + if (!clientInstrumenter().shouldStart(parentContext, request)) { + return; + } + Context context = clientInstrumenter().start(parentContext, request); + this.requestScopeContext = RequestScopeContext.create(request, null, context); + } + } finally { + if (this.isOneway() && message.type != TMessageType.ONEWAY) { + TMessage onewayMessage = new TMessage(message.name, TMessageType.ONEWAY, message.seqid); + super.writeMessageBegin(onewayMessage); + } else { + super.writeMessageBegin(message); + } + } + } + + @Override + public void writeFieldStop() throws TException { + try { + if (!this.injected && this.requestScopeContext != null) { + ThriftRequest request = this.requestScopeContext.getRequest(); + this.writeHeader(request.getHeader()); + } + } finally { + this.injected = true; + super.writeFieldStop(); + } + } + + public void writeHeader(Map header) throws TException { + super.writeFieldBegin(new TField(OT_MAGIC_FIELD, TType.MAP, OT_MAGIC_FIELD_ID)); + super.writeMapBegin(new TMap(TType.STRING, TType.STRING, header.size())); + + Set> entries = header.entrySet(); + for (Map.Entry entry : entries) { + super.writeString(entry.getKey()); + super.writeString(entry.getValue()); + } + + super.writeMapEnd(); + super.writeFieldEnd(); + } + + public boolean isOneway() { + return this.type == TMessageType.ONEWAY; + } + + public boolean isChangeToOneway() { + return this.type != this.originType; + } + + public void updateTransport(TTransport transport) { + this.transport = transport; + } + + public RequestScopeContext getRequestScopeContext() { + return requestScopeContext; + } + + public void setRequestScopeContext(RequestScopeContext requestScopeContext) { + this.requestScopeContext = requestScopeContext; + } + + public void setServiceName(String serviceName) { + this.serviceName = serviceName; + } + + public void setType(byte type) { + this.type = type; + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/client/ClientProtocolFactoryWrapper.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/client/ClientProtocolFactoryWrapper.java new file mode 100644 index 000000000000..0e869b5be690 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/client/ClientProtocolFactoryWrapper.java @@ -0,0 +1,41 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.client; + +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TTransport; + +@SuppressWarnings({"serial"}) +public final class ClientProtocolFactoryWrapper implements TProtocolFactory { + public TProtocolFactory delegate; + public TTransport transport; + public String serviceName; + + @Override + public TProtocol getProtocol(TTransport transport) { + TProtocol protocol = this.delegate.getProtocol(transport); + if (protocol instanceof ClientOutProtocolWrapper) { + if (transport != null) { + ((ClientOutProtocolWrapper) protocol).updateTransport(this.transport); + } + ((ClientOutProtocolWrapper) protocol).setServiceName(this.serviceName); + return protocol; + } + protocol = new ClientOutProtocolWrapper(protocol, this.serviceName, null); + if (transport != null) { + ((ClientOutProtocolWrapper) protocol).updateTransport(this.transport); + } + return protocol; + } + + public ClientProtocolFactoryWrapper( + TProtocolFactory protocolFactory, TTransport transport, String serviceName) { + this.delegate = protocolFactory; + this.transport = transport; + this.serviceName = serviceName; + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/client/ThriftAsyncClientInstrumentation.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/client/ThriftAsyncClientInstrumentation.java new file mode 100644 index 000000000000..22cd63a452cc --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/client/ThriftAsyncClientInstrumentation.java @@ -0,0 +1,44 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.client; + +import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.extendsClass; +import static net.bytebuddy.matcher.ElementMatchers.isConstructor; +import static net.bytebuddy.matcher.ElementMatchers.named; + +import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; +import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; +import net.bytebuddy.asm.Advice; +import net.bytebuddy.description.type.TypeDescription; +import net.bytebuddy.matcher.ElementMatcher; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TTransport; + +public final class ThriftAsyncClientInstrumentation implements TypeInstrumentation { + @Override + public ElementMatcher typeMatcher() { + return extendsClass(named("org.apache.thrift.async.TAsyncClient")); + } + + @Override + public void transform(TypeTransformer transformer) { + transformer.applyAdviceToMethod( + isConstructor(), ThriftAsyncClientInstrumentation.class.getName() + "$ConstructorAdvice"); + } + + public static class ConstructorAdvice { + @Advice.OnMethodEnter(suppress = Throwable.class) + public static void onEnter( + @Advice.Origin("#t") String serviceName, + @Advice.Argument(value = 0, readOnly = false) TProtocolFactory factory, + @Advice.Argument(value = 2) TTransport transport) { + if (factory instanceof ClientProtocolFactoryWrapper) { + return; + } + factory = new ClientProtocolFactoryWrapper(factory, transport, serviceName); + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/client/ThriftAsyncMethodCallInstrumentation.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/client/ThriftAsyncMethodCallInstrumentation.java new file mode 100644 index 000000000000..9d189c9a02df --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/client/ThriftAsyncMethodCallInstrumentation.java @@ -0,0 +1,64 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.client; + +import static net.bytebuddy.matcher.ElementMatchers.isConstructor; +import static net.bytebuddy.matcher.ElementMatchers.isMethod; +import static net.bytebuddy.matcher.ElementMatchers.named; +import static net.bytebuddy.matcher.ElementMatchers.takesArgument; + +import io.opentelemetry.instrumentation.api.util.VirtualField; +import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; +import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.AsyncMethodCallbackWrapper; +import net.bytebuddy.asm.Advice; +import net.bytebuddy.description.type.TypeDescription; +import net.bytebuddy.matcher.ElementMatcher; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncMethodCall; + +public final class ThriftAsyncMethodCallInstrumentation implements TypeInstrumentation { + + @Override + public ElementMatcher typeMatcher() { + return named("org.apache.thrift.async.TAsyncMethodCall"); + } + + @Override + public void transform(TypeTransformer transformer) { + transformer.applyAdviceToMethod( + isConstructor().and(takesArgument(3, named("org.apache.thrift.async.AsyncMethodCallback"))), + ThriftAsyncMethodCallInstrumentation.class.getName() + "$ConstructorAdvice"); + + transformer.applyAdviceToMethod( + isMethod().and(named("prepareMethodCall")), + ThriftAsyncMethodCallInstrumentation.class.getName() + "$MethodCallAdvice"); + } + + public static class ConstructorAdvice { + @Advice.OnMethodEnter(suppress = Throwable.class) + public static void onEnter( + @Advice.Argument(value = 3, readOnly = false) AsyncMethodCallback callback) { + if (callback instanceof AsyncMethodCallbackWrapper) { + return; + } + callback = new AsyncMethodCallbackWrapper<>(callback, false); + } + } + + public static class MethodCallAdvice { + @Advice.OnMethodEnter(suppress = Throwable.class) + public static void methodEnter( + @Advice.This TAsyncMethodCall thiz, + @Advice.FieldValue(value = "callback") AsyncMethodCallback callback) { + if (callback instanceof AsyncMethodCallbackWrapper) { + VirtualField, AsyncMethodCallback> virtualField = + VirtualField.find(TAsyncMethodCall.class, AsyncMethodCallback.class); + virtualField.set(thiz, callback); + } + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/client/ThriftAsyncWriteArgsInstrumentation.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/client/ThriftAsyncWriteArgsInstrumentation.java new file mode 100644 index 000000000000..895489f6a0ac --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/client/ThriftAsyncWriteArgsInstrumentation.java @@ -0,0 +1,87 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.client; + +import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.extendsClass; +import static io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.ThriftSingletons.clientInstrumenter; +import static net.bytebuddy.matcher.ElementMatchers.isMethod; +import static net.bytebuddy.matcher.ElementMatchers.named; + +import io.opentelemetry.context.Context; +import io.opentelemetry.instrumentation.api.util.VirtualField; +import io.opentelemetry.instrumentation.thrift.common.RequestScopeContext; +import io.opentelemetry.instrumentation.thrift.common.client.MethodAccessor; +import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; +import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.AsyncMethodCallbackWrapper; +import java.util.Set; +import net.bytebuddy.asm.Advice; +import net.bytebuddy.description.type.TypeDescription; +import net.bytebuddy.matcher.ElementMatcher; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncMethodCall; +import org.apache.thrift.protocol.TMessageType; +import org.apache.thrift.protocol.TProtocol; + +public final class ThriftAsyncWriteArgsInstrumentation implements TypeInstrumentation { + + @Override + public ElementMatcher typeMatcher() { + return extendsClass(named("org.apache.thrift.async.TAsyncMethodCall")); + } + + @Override + public void transform(TypeTransformer transformer) { + transformer.applyAdviceToMethod( + isMethod().and(named("write_args")), + ThriftAsyncWriteArgsInstrumentation.class.getName() + "$WriteArgsAdvice"); + } + + public static class WriteArgsAdvice { + @Advice.OnMethodEnter(suppress = Throwable.class) + public static void methodEnter( + @Advice.Origin("#t") String serviceName, @Advice.Argument(value = 0) TProtocol protocol) { + if (protocol instanceof ClientOutProtocolWrapper) { + Set methodNames = MethodAccessor.voidMethodNames(serviceName); + // Compatible with asynchronous oneway method + if (methodNames.contains("getResult")) { + ClientOutProtocolWrapper wrapper = (ClientOutProtocolWrapper) protocol; + wrapper.setType(TMessageType.ONEWAY); + } + } + } + + @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class) + public static void methodExit( + @Advice.This TAsyncMethodCall methodCall, + @Advice.Argument(value = 0) TProtocol protocol, + @Advice.Thrown Throwable throwable) { + if (protocol instanceof ClientOutProtocolWrapper) { + ClientOutProtocolWrapper wrapper = (ClientOutProtocolWrapper) protocol; + RequestScopeContext requestScopeContext = wrapper.getRequestScopeContext(); + if (requestScopeContext == null) { + return; + } + // wrapper.isChangeToOneway() judgment logic is for compatibility with version 0.9.1 + // the return value is void but is not oneway method + if (throwable != null) { + requestScopeContext.close(); + Context context = requestScopeContext.getContext(); + clientInstrumenter().end(context, requestScopeContext.getRequest(), null, throwable); + wrapper.setRequestScopeContext(null); + return; + } + + VirtualField, AsyncMethodCallback> callbackVirtualField = + VirtualField.find(TAsyncMethodCall.class, AsyncMethodCallback.class); + AsyncMethodCallback callback = callbackVirtualField.get(methodCall); + if (callback instanceof AsyncMethodCallbackWrapper) { + ((AsyncMethodCallbackWrapper) callback).setRequestScopeContext(requestScopeContext); + } + } + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/client/ThriftClientCommonInstrumentationModule.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/client/ThriftClientCommonInstrumentationModule.java new file mode 100644 index 000000000000..70055624500f --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/client/ThriftClientCommonInstrumentationModule.java @@ -0,0 +1,36 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.client; + +import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.hasClassesNamed; +import static java.util.Arrays.asList; + +import com.google.auto.service.AutoService; +import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule; +import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; +import java.util.List; +import net.bytebuddy.matcher.ElementMatcher; + +@AutoService(InstrumentationModule.class) +public final class ThriftClientCommonInstrumentationModule extends InstrumentationModule { + + public ThriftClientCommonInstrumentationModule() { + super("thrift", "thrift-0.9.1", "thrift-0.9.1-client"); + } + + @Override + public ElementMatcher.Junction classLoaderMatcher() { + return hasClassesNamed("org.apache.thrift.protocol.TProtocolDecorator"); + } + + @Override + public List typeInstrumentations() { + return asList( + new ThriftAsyncClientInstrumentation(), + new ThriftAsyncMethodCallInstrumentation(), + new ThriftAsyncWriteArgsInstrumentation()); + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/client/ThriftClientInstrumentation.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/client/ThriftClientInstrumentation.java new file mode 100644 index 000000000000..d991f84ce16f --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/client/ThriftClientInstrumentation.java @@ -0,0 +1,128 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.client; + +import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.extendsClass; +import static io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.ThriftSingletons.clientInstrumenter; +import static net.bytebuddy.matcher.ElementMatchers.isConstructor; +import static net.bytebuddy.matcher.ElementMatchers.isMethod; +import static net.bytebuddy.matcher.ElementMatchers.isProtected; +import static net.bytebuddy.matcher.ElementMatchers.named; +import static net.bytebuddy.matcher.ElementMatchers.takesArguments; + +import io.opentelemetry.context.Context; +import io.opentelemetry.instrumentation.thrift.common.RequestScopeContext; +import io.opentelemetry.instrumentation.thrift.common.client.MethodAccessor; +import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; +import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; +import java.util.Set; +import net.bytebuddy.asm.Advice; +import net.bytebuddy.description.type.TypeDescription; +import net.bytebuddy.matcher.ElementMatcher; +import org.apache.thrift.protocol.TProtocol; + +public final class ThriftClientInstrumentation implements TypeInstrumentation { + + @Override + public ElementMatcher typeMatcher() { + return extendsClass(named("org.apache.thrift.TServiceClient")); + } + + @Override + public void transform(TypeTransformer transformer) { + transformer.applyAdviceToMethod( + isConstructor().and(takesArguments(1)), + ThriftClientInstrumentation.class.getName() + "$ConstructorOneAdvice"); + + transformer.applyAdviceToMethod( + isConstructor().and(takesArguments(2)), + ThriftClientInstrumentation.class.getName() + "$ConstructorTowAdvice"); + + transformer.applyAdviceToMethod( + isMethod().and(isProtected()).and(named("sendBase")), + ThriftClientInstrumentation.class.getName() + "$ClientSendAdvice"); + + transformer.applyAdviceToMethod( + isMethod().and(named("receiveBase")), + ThriftClientInstrumentation.class.getName() + "$ClientReceiveAdvice"); + } + + public static class ConstructorOneAdvice { + @Advice.OnMethodEnter(suppress = Throwable.class) + public static void onEnter( + @Advice.Origin("#t") String serviceName, + @Advice.Argument(value = 0, readOnly = false) TProtocol inProtocol) { + Set voidMethodNames = MethodAccessor.voidMethodNames(serviceName); + if (!(inProtocol instanceof ClientOutProtocolWrapper)) { + inProtocol = new ClientOutProtocolWrapper(inProtocol, serviceName, voidMethodNames); + } + } + } + + public static class ConstructorTowAdvice { + @Advice.OnMethodEnter(suppress = Throwable.class) + public static void onEnter( + @Advice.Origin("#t") String serviceName, + @Advice.Argument(value = 0, readOnly = false) TProtocol inProtocol, + @Advice.Argument(value = 1, readOnly = false) TProtocol outProtocol) { + Set voidMethodNames = MethodAccessor.voidMethodNames(serviceName); + if (!(inProtocol instanceof ClientOutProtocolWrapper)) { + inProtocol = new ClientOutProtocolWrapper(inProtocol, serviceName, voidMethodNames); + } + if (!(outProtocol instanceof ClientOutProtocolWrapper)) { + outProtocol = new ClientOutProtocolWrapper(outProtocol, serviceName, voidMethodNames); + } + } + } + + public static class ClientSendAdvice { + @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class) + public static void methodExit( + @Advice.FieldValue(value = "oprot_") TProtocol outProtocol, + @Advice.Thrown Throwable throwable) { + if (outProtocol != null && outProtocol instanceof ClientOutProtocolWrapper) { + ClientOutProtocolWrapper wrapper = (ClientOutProtocolWrapper) outProtocol; + RequestScopeContext requestScopeContext = wrapper.getRequestScopeContext(); + if (requestScopeContext == null) { + return; + } + + Context context = requestScopeContext.getContext(); + if (throwable != null) { + requestScopeContext.close(); + clientInstrumenter().end(context, requestScopeContext.getRequest(), null, throwable); + wrapper.setRequestScopeContext(null); + return; + } + + if (wrapper.isOneway()) { + requestScopeContext.close(); + clientInstrumenter().end(context, requestScopeContext.getRequest(), 0, null); + wrapper.setRequestScopeContext(null); + } + } + } + } + + public static class ClientReceiveAdvice { + @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class) + public static void methodExit( + @Advice.Thrown Throwable throwable, + @Advice.FieldValue(value = "oprot_") TProtocol outProtocol) { + if (outProtocol != null && outProtocol instanceof ClientOutProtocolWrapper) { + ClientOutProtocolWrapper wrapper = (ClientOutProtocolWrapper) outProtocol; + RequestScopeContext requestScopeContext = wrapper.getRequestScopeContext(); + if (requestScopeContext == null) { + return; + } + requestScopeContext.close(); + Context context = requestScopeContext.getContext(); + clientInstrumenter().end(context, requestScopeContext.getRequest(), null, throwable); + wrapper.setRequestScopeContext(null); + } + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/client/ThriftClientInstrumentationModule.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/client/ThriftClientInstrumentationModule.java new file mode 100644 index 000000000000..18b786f31260 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/client/ThriftClientInstrumentationModule.java @@ -0,0 +1,35 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.client; + +import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.hasClassesNamed; +import static java.util.Arrays.asList; +import static net.bytebuddy.matcher.ElementMatchers.not; + +import com.google.auto.service.AutoService; +import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule; +import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; +import java.util.List; +import net.bytebuddy.matcher.ElementMatcher; + +@AutoService(InstrumentationModule.class) +public final class ThriftClientInstrumentationModule extends InstrumentationModule { + + public ThriftClientInstrumentationModule() { + super("thrift", "thrift-0.9.1", "thrift-0.9.1-client"); + } + + @Override + public ElementMatcher.Junction classLoaderMatcher() { + return hasClassesNamed("org.apache.thrift.protocol.TProtocolDecorator") + .and(not(hasClassesNamed("org.apache.thrift.TAsyncProcessor"))); + } + + @Override + public List typeInstrumentations() { + return asList(new ThriftClientInstrumentation()); + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/client/v3/ThriftClientInstrumentation.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/client/v3/ThriftClientInstrumentation.java new file mode 100644 index 000000000000..fff760f210f9 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/client/v3/ThriftClientInstrumentation.java @@ -0,0 +1,131 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.client.v3; + +import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.extendsClass; +import static io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.ThriftSingletons.clientInstrumenter; +import static net.bytebuddy.matcher.ElementMatchers.isConstructor; +import static net.bytebuddy.matcher.ElementMatchers.isMethod; +import static net.bytebuddy.matcher.ElementMatchers.isPrivate; +import static net.bytebuddy.matcher.ElementMatchers.named; +import static net.bytebuddy.matcher.ElementMatchers.takesArguments; + +import io.opentelemetry.context.Context; +import io.opentelemetry.instrumentation.thrift.common.RequestScopeContext; +import io.opentelemetry.instrumentation.thrift.common.client.MethodAccessor; +import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; +import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.client.ClientOutProtocolWrapper; +import java.util.Set; +import net.bytebuddy.asm.Advice; +import net.bytebuddy.description.type.TypeDescription; +import net.bytebuddy.matcher.ElementMatcher; +import org.apache.thrift.protocol.TProtocol; + +public final class ThriftClientInstrumentation implements TypeInstrumentation { + + @Override + public ElementMatcher typeMatcher() { + return extendsClass(named("org.apache.thrift.TServiceClient")); + } + + @Override + public void transform(TypeTransformer transformer) { + transformer.applyAdviceToMethod( + isConstructor().and(takesArguments(1)), + ThriftClientInstrumentation.class.getName() + "$ConstructorOneAdvice"); + + transformer.applyAdviceToMethod( + isConstructor().and(takesArguments(2)), + ThriftClientInstrumentation.class.getName() + "$ConstructorTowAdvice"); + + transformer.applyAdviceToMethod( + isMethod().and(isPrivate()).and(named("sendBase")), + ThriftClientInstrumentation.class.getName() + "$ClientSendAdvice"); + + transformer.applyAdviceToMethod( + isMethod().and(named("receiveBase")), + ThriftClientInstrumentation.class.getName() + "$ClientReceiveAdvice"); + } + + public static class ConstructorOneAdvice { + @Advice.OnMethodEnter(suppress = Throwable.class) + public static void onEnter( + @Advice.Origin("#t") String serviceName, + @Advice.Argument(value = 0, readOnly = false) TProtocol inProtocol) { + // Compatible with thrift version 0.9.3, using thrift-generated java files + Set voidMethodNames = MethodAccessor.voidMethodNames(serviceName); + if (!(inProtocol instanceof ClientOutProtocolWrapper)) { + inProtocol = new ClientOutProtocolWrapper(inProtocol, serviceName, voidMethodNames); + } + } + } + + public static class ConstructorTowAdvice { + @Advice.OnMethodEnter(suppress = Throwable.class) + public static void onEnter( + @Advice.Origin("#t") String serviceName, + @Advice.Argument(value = 0, readOnly = false) TProtocol inProtocol, + @Advice.Argument(value = 1, readOnly = false) TProtocol outProtocol) { + // Compatible with thrift version 0.9.3, using thrift-generated java files + Set voidMethodNames = MethodAccessor.voidMethodNames(serviceName); + if (!(inProtocol instanceof ClientOutProtocolWrapper)) { + inProtocol = new ClientOutProtocolWrapper(inProtocol, serviceName, voidMethodNames); + } + if (!(outProtocol instanceof ClientOutProtocolWrapper)) { + outProtocol = new ClientOutProtocolWrapper(outProtocol, serviceName, voidMethodNames); + } + } + } + + public static class ClientSendAdvice { + @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class) + public static void methodExit( + @Advice.FieldValue(value = "oprot_") TProtocol outProtocol, + @Advice.Thrown Throwable throwable) { + if (outProtocol != null && outProtocol instanceof ClientOutProtocolWrapper) { + ClientOutProtocolWrapper wrapper = (ClientOutProtocolWrapper) outProtocol; + RequestScopeContext requestScopeContext = wrapper.getRequestScopeContext(); + if (requestScopeContext == null) { + return; + } + + Context context = requestScopeContext.getContext(); + if (throwable != null) { + requestScopeContext.close(); + clientInstrumenter().end(context, requestScopeContext.getRequest(), null, throwable); + wrapper.setRequestScopeContext(null); + return; + } + + if (wrapper.isOneway()) { + requestScopeContext.close(); + clientInstrumenter().end(context, requestScopeContext.getRequest(), 0, null); + wrapper.setRequestScopeContext(null); + } + } + } + } + + public static class ClientReceiveAdvice { + @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class) + public static void methodExit( + @Advice.Thrown Throwable throwable, + @Advice.FieldValue(value = "oprot_") TProtocol outProtocol) { + if (outProtocol != null && outProtocol instanceof ClientOutProtocolWrapper) { + ClientOutProtocolWrapper wrapper = (ClientOutProtocolWrapper) outProtocol; + RequestScopeContext requestScopeContext = wrapper.getRequestScopeContext(); + if (requestScopeContext == null) { + return; + } + requestScopeContext.close(); + Context context = requestScopeContext.getContext(); + clientInstrumenter().end(context, requestScopeContext.getRequest(), null, throwable); + wrapper.setRequestScopeContext(null); + } + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/client/v3/ThriftClientInstrumentationModule.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/client/v3/ThriftClientInstrumentationModule.java new file mode 100644 index 000000000000..34f86ab1354b --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/client/v3/ThriftClientInstrumentationModule.java @@ -0,0 +1,34 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.client.v3; + +import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.hasClassesNamed; +import static java.util.Arrays.asList; + +import com.google.auto.service.AutoService; +import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule; +import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; +import java.util.List; +import net.bytebuddy.matcher.ElementMatcher; + +@AutoService(InstrumentationModule.class) +public final class ThriftClientInstrumentationModule extends InstrumentationModule { + + public ThriftClientInstrumentationModule() { + super("thrift", "thrift-0.9.1", "thrift-0.9.3-client"); + } + + @Override + public ElementMatcher.Junction classLoaderMatcher() { + return hasClassesNamed("org.apache.thrift.protocol.TProtocolDecorator") + .and(hasClassesNamed("org.apache.thrift.TAsyncProcessor")); + } + + @Override + public List typeInstrumentations() { + return asList(new ThriftClientInstrumentation()); + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ServerInProtocolWrapper.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ServerInProtocolWrapper.java new file mode 100644 index 000000000000..5fdfa9fb37a4 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ServerInProtocolWrapper.java @@ -0,0 +1,133 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.server; + +import static io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.ThriftSingletons.serverInstrumenter; + +import io.opentelemetry.context.Context; +import io.opentelemetry.context.Scope; +import io.opentelemetry.instrumentation.api.internal.Timer; +import io.opentelemetry.instrumentation.thrift.common.RequestScopeContext; +import io.opentelemetry.instrumentation.thrift.common.SocketAccessor; +import io.opentelemetry.instrumentation.thrift.common.ThriftRequest; +import io.opentelemetry.javaagent.bootstrap.Java8BytecodeBridge; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.AbstractProtocolWrapper; +import java.net.Socket; +import java.util.HashMap; +import java.util.Map; +import org.apache.thrift.TException; +import org.apache.thrift.protocol.TField; +import org.apache.thrift.protocol.TMap; +import org.apache.thrift.protocol.TMessage; +import org.apache.thrift.protocol.TMessageType; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TType; +import org.apache.thrift.transport.TTransport; + +public final class ServerInProtocolWrapper extends AbstractProtocolWrapper { + + private volatile RequestScopeContext requestScopeContext; + private String methodName; + private String serviceName; + public TTransport transport; + private byte type; + private Timer timer; + + public ServerInProtocolWrapper(TProtocol protocol) { + super(protocol); + } + + @Override + public TMessage readMessageBegin() throws TException { + TMessage message = super.readMessageBegin(); + this.methodName = message.name; + this.type = message.type; + this.timer = Timer.start(); + return message; + } + + @Override + public TField readFieldBegin() throws TException { + TField field = super.readFieldBegin(); + if (field.id == OT_MAGIC_FIELD_ID && field.type == TType.MAP) { + try { + TMap map = super.readMapBegin(); + Map header = new HashMap<>(map.size); + + for (int i = 0; i < map.size; i++) { + header.put(readString(), readString()); + } + + Socket socket = SocketAccessor.getSocket(super.getTransport()); + if (socket == null) { + socket = SocketAccessor.getSocket(this.transport); + } + ThriftRequest request = + ThriftRequest.create(this.serviceName, this.methodName, socket, header); + Context parentContext = Java8BytecodeBridge.currentContext(); + if (!serverInstrumenter().shouldStart(parentContext, request)) { + return field; + } + Context context = serverInstrumenter().start(parentContext, request); + this.requestScopeContext = RequestScopeContext.create(request, null, context); + } finally { + super.readMapEnd(); + super.readFieldEnd(); + } + return this.readFieldBegin(); + } + return field; + } + + @Override + public void readMessageEnd() throws TException { + super.readMessageEnd(); + if (this.requestScopeContext == null) { + Socket socket = SocketAccessor.getSocket(super.getTransport()); + ThriftRequest request = + ThriftRequest.create(this.serviceName, this.methodName, socket, new HashMap<>()); + Context parentContext = Java8BytecodeBridge.currentContext(); + if (!serverInstrumenter().shouldStart(parentContext, request)) { + return; + } + Context context = serverInstrumenter().start(parentContext, request); + Scope scope = context.makeCurrent(); + this.requestScopeContext = RequestScopeContext.create(request, scope, context); + } + } + + public String getMethodName() { + return methodName; + } + + public boolean isOneway() { + return type == TMessageType.ONEWAY; + } + + public RequestScopeContext getRequestScopeContext() { + return requestScopeContext; + } + + public void setRequestScopeContext(RequestScopeContext requestScopeContext) { + this.requestScopeContext = requestScopeContext; + } + + public Timer getTimer() { + return timer; + } + + public String getServiceName() { + return serviceName; + } + + public void setServiceName(String serviceName) { + this.serviceName = serviceName; + } + + public void setTransport(TTransport transport) { + this.transport = transport; + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ServerProtocolFactoryWrapper.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ServerProtocolFactoryWrapper.java new file mode 100644 index 000000000000..b860eea52397 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ServerProtocolFactoryWrapper.java @@ -0,0 +1,28 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.server; + +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TTransport; + +@SuppressWarnings({"serial"}) +public final class ServerProtocolFactoryWrapper implements TProtocolFactory { + public TProtocolFactory delegate; + + @Override + public TProtocol getProtocol(TTransport transport) { + TProtocol protocol = delegate.getProtocol(transport); + if (protocol instanceof ServerInProtocolWrapper) { + return protocol; + } + return new ServerInProtocolWrapper(protocol); + } + + public ServerProtocolFactoryWrapper(TProtocolFactory protocolFactory) { + this.delegate = protocolFactory; + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ThriftAsyncProcessInstrumentation.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ThriftAsyncProcessInstrumentation.java new file mode 100644 index 000000000000..64717331f879 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ThriftAsyncProcessInstrumentation.java @@ -0,0 +1,58 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.server; + +import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.extendsClass; +import static net.bytebuddy.matcher.ElementMatchers.isMethod; +import static net.bytebuddy.matcher.ElementMatchers.named; + +import io.opentelemetry.instrumentation.thrift.common.RequestScopeContext; +import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; +import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.AsyncMethodCallbackWrapper; +import net.bytebuddy.asm.Advice; +import net.bytebuddy.description.type.TypeDescription; +import net.bytebuddy.matcher.ElementMatcher; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.server.AbstractNonblockingServer; + +public final class ThriftAsyncProcessInstrumentation implements TypeInstrumentation { + + @Override + public ElementMatcher typeMatcher() { + return extendsClass(named("org.apache.thrift.AsyncProcessFunction")); + } + + @Override + public void transform(TypeTransformer transformer) { + transformer.applyAdviceToMethod( + isMethod().and(named("getResultHandler")), + ThriftAsyncProcessInstrumentation.class.getName() + "$GetResultHandlerAdvice"); + } + + public static class GetResultHandlerAdvice { + + @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class) + public static void methodExit( + @Advice.Argument(value = 0) AbstractNonblockingServer.AsyncFrameBuffer fb, + @Advice.Return(readOnly = false) AsyncMethodCallback callback) { + TProtocol inProtocol = fb.getInputProtocol(); + if (inProtocol instanceof ServerInProtocolWrapper) { + ServerInProtocolWrapper wrapper = (ServerInProtocolWrapper) inProtocol; + RequestScopeContext requestScopeContext = wrapper.getRequestScopeContext(); + if (requestScopeContext == null) { + return; + } + + AsyncMethodCallbackWrapper callbackWrapper = + new AsyncMethodCallbackWrapper<>(callback, true); + callbackWrapper.setRequestScopeContext(requestScopeContext); + callback = callbackWrapper; + } + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ThriftBaseAsyncProcessorInstrumentation.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ThriftBaseAsyncProcessorInstrumentation.java new file mode 100644 index 000000000000..52ec4f2de55a --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ThriftBaseAsyncProcessorInstrumentation.java @@ -0,0 +1,73 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.server; + +import static io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.ThriftSingletons.serverInstrumenter; +import static net.bytebuddy.matcher.ElementMatchers.isMethod; +import static net.bytebuddy.matcher.ElementMatchers.named; +import static net.bytebuddy.matcher.ElementMatchers.takesArguments; + +import io.opentelemetry.context.Context; +import io.opentelemetry.instrumentation.thrift.common.RequestScopeContext; +import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; +import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; +import net.bytebuddy.asm.Advice; +import net.bytebuddy.description.type.TypeDescription; +import net.bytebuddy.matcher.ElementMatcher; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.server.AbstractNonblockingServer; + +public final class ThriftBaseAsyncProcessorInstrumentation implements TypeInstrumentation { + @Override + public ElementMatcher typeMatcher() { + return named("org.apache.thrift.TBaseAsyncProcessor"); + } + + @Override + public void transform(TypeTransformer transformer) { + transformer.applyAdviceToMethod( + isMethod().and(named("process")).and(takesArguments(1)), + ThriftBaseAsyncProcessorInstrumentation.class.getName() + "$ProcessAdvice"); + } + + public static class ProcessAdvice { + + @Advice.OnMethodEnter(suppress = Throwable.class) + public static void methodEnter( + @Advice.Argument(0) AbstractNonblockingServer.AsyncFrameBuffer fb, + @Advice.FieldValue(value = "iface") Object iface) { + String serviceName = iface.getClass().getName(); + TProtocol inProtocol = fb.getInputProtocol(); + if (inProtocol instanceof ServerInProtocolWrapper) { + ServerInProtocolWrapper wrapper = (ServerInProtocolWrapper) inProtocol; + wrapper.setServiceName(serviceName); + } + } + + @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class) + public static void methodExit( + @Advice.Argument(0) AbstractNonblockingServer.AsyncFrameBuffer fb, + @Advice.Thrown Throwable throwable) { + TProtocol inProtocol = fb.getInputProtocol(); + if (inProtocol instanceof ServerInProtocolWrapper) { + ServerInProtocolWrapper wrapper = (ServerInProtocolWrapper) inProtocol; + if (throwable == null && !wrapper.isOneway()) { + return; + } + + RequestScopeContext requestScopeContext = wrapper.getRequestScopeContext(); + if (requestScopeContext == null) { + return; + } + + requestScopeContext.close(); + Context context = requestScopeContext.getContext(); + serverInstrumenter().end(context, requestScopeContext.getRequest(), null, throwable); + wrapper.setRequestScopeContext(null); + } + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ThriftBaseProcessorInstrumentation.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ThriftBaseProcessorInstrumentation.java new file mode 100644 index 000000000000..1c38bf51e084 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ThriftBaseProcessorInstrumentation.java @@ -0,0 +1,83 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.server; + +import static io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.ThriftSingletons.serverInstrumenter; +import static net.bytebuddy.matcher.ElementMatchers.isMethod; +import static net.bytebuddy.matcher.ElementMatchers.named; + +import io.opentelemetry.context.Context; +import io.opentelemetry.instrumentation.thrift.common.RequestScopeContext; +import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; +import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; +import java.lang.reflect.Field; +import net.bytebuddy.asm.Advice; +import net.bytebuddy.description.type.TypeDescription; +import net.bytebuddy.matcher.ElementMatcher; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolDecorator; + +public final class ThriftBaseProcessorInstrumentation implements TypeInstrumentation { + + @Override + public ElementMatcher typeMatcher() { + return named("org.apache.thrift.TBaseProcessor"); + } + + @Override + public void transform(TypeTransformer transformer) { + transformer.applyAdviceToMethod( + isMethod().and(named("process")), + ThriftBaseProcessorInstrumentation.class.getName() + "$ProcessAdvice"); + } + + public static class ProcessAdvice { + @Advice.OnMethodEnter(suppress = Throwable.class) + public static void methodEnter( + @Advice.Argument(value = 0) TProtocol inProtocol, + @Advice.FieldValue(value = "iface") Object iface) { + String serviceName = iface.getClass().getName(); + if (inProtocol instanceof ServerInProtocolWrapper) { + ServerInProtocolWrapper wrapper = (ServerInProtocolWrapper) inProtocol; + wrapper.setServiceName(serviceName); + } else if (inProtocol instanceof TProtocolDecorator) { + // TMultiplexedProcessor compatible + Field field = null; + try { + field = TProtocolDecorator.class.getDeclaredField("concreteProtocol"); + field.setAccessible(true); + Object obj = field.get(inProtocol); + if (obj != null && obj instanceof ServerInProtocolWrapper) { + ServerInProtocolWrapper wrapper = (ServerInProtocolWrapper) obj; + wrapper.setServiceName(serviceName); + } + } catch (Throwable ignored) { + // reflection error; in practice should never happen, we can ignore it + } + } + } + + @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class) + public static void methodExit( + @Advice.Argument(value = 0) TProtocol inProtocol, @Advice.Thrown Throwable throwable) { + if (inProtocol instanceof ServerInProtocolWrapper) { + ServerInProtocolWrapper wrapper = (ServerInProtocolWrapper) inProtocol; + String methodName = wrapper.getMethodName(); + if (methodName == null || methodName.isEmpty()) { + return; + } + RequestScopeContext requestScopeContext = wrapper.getRequestScopeContext(); + if (requestScopeContext == null) { + return; + } + requestScopeContext.close(); + Context context = requestScopeContext.getContext(); + serverInstrumenter().end(context, requestScopeContext.getRequest(), null, throwable); + wrapper.setRequestScopeContext(null); + } + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ThriftFrameBufferInstrumentation.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ThriftFrameBufferInstrumentation.java new file mode 100644 index 000000000000..07f495d9ba75 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ThriftFrameBufferInstrumentation.java @@ -0,0 +1,45 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.server; + +import static net.bytebuddy.matcher.ElementMatchers.isMethod; +import static net.bytebuddy.matcher.ElementMatchers.named; + +import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; +import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; +import net.bytebuddy.asm.Advice; +import net.bytebuddy.description.type.TypeDescription; +import net.bytebuddy.matcher.ElementMatcher; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.transport.TNonblockingTransport; + +public final class ThriftFrameBufferInstrumentation implements TypeInstrumentation { + + @Override + public ElementMatcher typeMatcher() { + return named("org.apache.thrift.server.AbstractNonblockingServer$FrameBuffer") + .or(named("org.apache.thrift.server.AbstractNonblockingServer$AsyncFrameBuffer")); + } + + @Override + public void transform(TypeTransformer transformer) { + transformer.applyAdviceToMethod( + isMethod().and(named("invoke")), + ThriftFrameBufferInstrumentation.class.getName() + "$FrameBufferConstructorAdvice"); + } + + public static class FrameBufferConstructorAdvice { + @Advice.OnMethodEnter(suppress = Throwable.class) + public static void methodEnter( + @Advice.FieldValue(value = "inProt_", readOnly = false) TProtocol inProtocol, + @Advice.FieldValue(value = "trans_") TNonblockingTransport transport) { + if (inProtocol instanceof ServerInProtocolWrapper) { + ServerInProtocolWrapper wrapper = (ServerInProtocolWrapper) inProtocol; + wrapper.setTransport(transport); + } + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ThriftMutiplexedProcessorInstrumentation.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ThriftMutiplexedProcessorInstrumentation.java new file mode 100644 index 000000000000..3667dbad0dca --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ThriftMutiplexedProcessorInstrumentation.java @@ -0,0 +1,84 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.server; + +import static io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.ThriftSingletons.serverInstrumenter; +import static net.bytebuddy.matcher.ElementMatchers.isMethod; +import static net.bytebuddy.matcher.ElementMatchers.named; + +import io.opentelemetry.context.Context; +import io.opentelemetry.instrumentation.api.internal.InstrumenterUtil; +import io.opentelemetry.instrumentation.api.internal.Timer; +import io.opentelemetry.instrumentation.thrift.common.RequestScopeContext; +import io.opentelemetry.instrumentation.thrift.common.SocketAccessor; +import io.opentelemetry.instrumentation.thrift.common.ThriftRequest; +import io.opentelemetry.javaagent.bootstrap.Java8BytecodeBridge; +import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; +import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; +import java.net.Socket; +import java.util.HashMap; +import net.bytebuddy.asm.Advice; +import net.bytebuddy.description.type.TypeDescription; +import net.bytebuddy.matcher.ElementMatcher; +import org.apache.thrift.protocol.TProtocol; + +public final class ThriftMutiplexedProcessorInstrumentation implements TypeInstrumentation { + + @Override + public ElementMatcher typeMatcher() { + return named("org.apache.thrift.TMultiplexedProcessor"); + } + + @Override + public void transform(TypeTransformer transformer) { + transformer.applyAdviceToMethod( + isMethod().and(named("process")), + ThriftMutiplexedProcessorInstrumentation.class.getName() + "$ProcessAdvice"); + } + + public static class ProcessAdvice { + + @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class) + public static void methodExit( + @Advice.Argument(value = 0) TProtocol inProtocol, @Advice.Thrown Throwable throwable) { + if (inProtocol instanceof ServerInProtocolWrapper) { + ServerInProtocolWrapper wrapper = (ServerInProtocolWrapper) inProtocol; + String methodName = wrapper.getMethodName(); + if (methodName == null || methodName.isEmpty()) { + return; + } + + RequestScopeContext requestScopeContext = wrapper.getRequestScopeContext(); + if (requestScopeContext == null) { + if (throwable != null) { + Timer timer = wrapper.getTimer(); + Socket socket = SocketAccessor.getSocket(wrapper.getTransport()); + ThriftRequest request = + ThriftRequest.create( + wrapper.getServiceName(), wrapper.getMethodName(), socket, new HashMap<>()); + Context parentContext = Java8BytecodeBridge.currentContext(); + if (serverInstrumenter().shouldStart(parentContext, request)) { + InstrumenterUtil.startAndEnd( + serverInstrumenter(), + parentContext, + request, + null, + throwable, + timer.startTime(), + timer.now()); + wrapper.setRequestScopeContext(null); + } + } + return; + } + + requestScopeContext.close(); + Context context = requestScopeContext.getContext(); + serverInstrumenter().end(context, requestScopeContext.getRequest(), null, throwable); + } + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ThriftServerInstrumentation.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ThriftServerInstrumentation.java new file mode 100644 index 000000000000..fd8f14ebf118 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ThriftServerInstrumentation.java @@ -0,0 +1,44 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.server; + +import static net.bytebuddy.matcher.ElementMatchers.isConstructor; +import static net.bytebuddy.matcher.ElementMatchers.named; +import static net.bytebuddy.matcher.ElementMatchers.takesArguments; + +import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; +import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; +import net.bytebuddy.asm.Advice; +import net.bytebuddy.description.type.TypeDescription; +import net.bytebuddy.matcher.ElementMatcher; +import org.apache.thrift.protocol.TProtocolFactory; + +public final class ThriftServerInstrumentation implements TypeInstrumentation { + @Override + public ElementMatcher typeMatcher() { + return named("org.apache.thrift.server.TServer"); + } + + @Override + public void transform(TypeTransformer transformer) { + transformer.applyAdviceToMethod( + isConstructor().and(takesArguments(1)), + ThriftServerInstrumentation.class.getName() + "$ServerConstructorAdvice"); + } + + public static class ServerConstructorAdvice { + + @Advice.OnMethodExit(suppress = Throwable.class) + public static void onExit( + @Advice.FieldValue(value = "inputProtocolFactory_", readOnly = false) + TProtocolFactory factory) { + if (factory instanceof ServerProtocolFactoryWrapper) { + return; + } + factory = new ServerProtocolFactoryWrapper(factory); + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ThriftServerInstrumentationModule.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ThriftServerInstrumentationModule.java new file mode 100644 index 000000000000..c5fc96c892a7 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ThriftServerInstrumentationModule.java @@ -0,0 +1,40 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.server; + +import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.hasClassesNamed; +import static java.util.Arrays.asList; + +import com.google.auto.service.AutoService; +import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule; +import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; +import java.util.List; +import net.bytebuddy.matcher.ElementMatcher; + +@AutoService(InstrumentationModule.class) +public final class ThriftServerInstrumentationModule extends InstrumentationModule { + + public ThriftServerInstrumentationModule() { + super("thrift", "thrift-0.9.1", "thrift-0.9.1-server"); + } + + @Override + public ElementMatcher.Junction classLoaderMatcher() { + return hasClassesNamed("org.apache.thrift.protocol.TProtocolDecorator"); + } + + @Override + public List typeInstrumentations() { + return asList( + new ThriftServerInstrumentation(), + new ThriftServletInstrumentation(), + new ThriftAsyncProcessInstrumentation(), + new ThriftFrameBufferInstrumentation(), + new ThriftBaseProcessorInstrumentation(), + new ThriftMutiplexedProcessorInstrumentation(), + new ThriftBaseAsyncProcessorInstrumentation()); + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ThriftServletInstrumentation.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ThriftServletInstrumentation.java new file mode 100644 index 000000000000..126235073983 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ThriftServletInstrumentation.java @@ -0,0 +1,43 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.server; + +import static net.bytebuddy.matcher.ElementMatchers.isConstructor; +import static net.bytebuddy.matcher.ElementMatchers.named; +import static net.bytebuddy.matcher.ElementMatchers.takesArguments; + +import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; +import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; +import net.bytebuddy.asm.Advice; +import net.bytebuddy.description.type.TypeDescription; +import net.bytebuddy.matcher.ElementMatcher; +import org.apache.thrift.protocol.TProtocolFactory; + +public final class ThriftServletInstrumentation implements TypeInstrumentation { + @Override + public ElementMatcher typeMatcher() { + return named("org.apache.thrift.server.TServlet"); + } + + @Override + public void transform(TypeTransformer transformer) { + transformer.applyAdviceToMethod( + isConstructor().and(takesArguments(1)), + ThriftServletInstrumentation.class.getName() + "$ServerConstructorAdvice"); + } + + public static class ServerConstructorAdvice { + + @Advice.OnMethodEnter(suppress = Throwable.class) + public static void onEnter( + @Advice.Argument(value = 1, readOnly = false) TProtocolFactory factory) { + if (factory instanceof ServerProtocolFactoryWrapper) { + return; + } + factory = new ServerProtocolFactoryWrapper(factory); + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/NoReturnTest.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/NoReturnTest.java new file mode 100644 index 000000000000..7741a96e8e3e --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/NoReturnTest.java @@ -0,0 +1,1164 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1; + +import io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFastFramedTransport; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class NoReturnTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + this.syncClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncClientSyncSimpleServerNoReturnMuti() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientNoReturn(port); + } + this.waitAndAssertTracesClientSyncServerSync("noReturn", 5); + } + + @Test + public void syncClientSyncSimpleServerNoReturnParallel() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientNoReturn(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerNoReturnParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("noReturn", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerNoReturn() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncClientSyncThreadPoolServerNoReturnMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientNoReturn(port); + } + this.waitAndAssertTracesClientSyncServerSync("noReturn", 5); + } + + @Test + public void syncClientSyncThreadPoolServerNoReturnParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientNoReturn(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerNoReturnParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("noReturn", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerNoReturn() throws TException { + int port = super.getPort(); + this.startMultiSimpleServer(port); + this.syncClientMultiNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", "syncHelloWorld:noReturn", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerNoReturnMuti() throws TException { + int port = super.getPort(); + this.startMultiSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiNoReturn(port); + } + this.waitAndAssertTracesClientSyncServerSync("noReturn", "syncHelloWorld:noReturn", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerNoReturnParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startMultiSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiNoReturn(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerNoReturnParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "noReturn", "syncHelloWorld:noReturn", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerNoReturnError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncClientNoReturn(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("noReturn", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerNoReturnError() { + Exception error = null; + try { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + this.syncClientNoReturn(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("noReturn", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerNoReturn() throws TException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + this.syncFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFastFramedClientAsyncThreadedSelectorServerNoReturn() throws TException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + this.syncFastFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorFastServerNoReturn() throws TException { + int port = super.getPort(); + this.startAsyncThreadedSelectorFastServer(port); + this.syncFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFastFramedClientAsyncThreadedSelectorFastServerNoReturn() throws TException { + int port = super.getPort(); + this.startAsyncThreadedSelectorFastServer(port); + this.syncFastFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerNoReturnMuti() throws TException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientNoReturn(port); + } + + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerNoReturnParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientNoReturn(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerNoReturn() throws TException { + int port = super.getPort(); + this.startMultiThreadedSelectorServer(port); + this.syncFramedClientMultiNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", "syncHelloWorld:noReturn", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerNoReturnMuti() throws TException { + int port = super.getPort(); + this.startMultiThreadedSelectorServer(port); + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiNoReturn(port); + } + this.waitAndAssertTracesClientSyncServerSync("noReturn", "syncHelloWorld:noReturn", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerNoReturnParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startMultiThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiNoReturn(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "noReturn", "syncHelloWorld:noReturn", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFastFramedClientSyncThreadedSelectorServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncFastFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorFastServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorFastServer(port); + this.syncFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFastFramedClientSyncThreadedSelectorFastServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorFastServer(port); + this.syncFastFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerNoReturnMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + for (int i = 0; i < 5; ++i) { + this.syncFramedClientNoReturn(port); + } + this.waitAndAssertTracesClientSyncServerSync("noReturn", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerNoReturnParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientNoReturn(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("noReturn", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerNoReturn() throws TException, IOException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + this.nonBlockClientNoReturn(port); + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerNoReturnMuti() + throws TException, IOException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + for (int i = 0; i < 5; ++i) { + this.nonBlockClientNoReturn(port); + } + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerNoReturnParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientNoReturn(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerNoReturn() throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.nonBlockClientNoReturn(port); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerNoReturnMuti() + throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + for (int i = 0; i < 5; ++i) { + this.nonBlockClientNoReturn(port); + } + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerNoReturnParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientNoReturn(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFastFramedClientSyncNonblockingServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncFastFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFramedClientSyncNonblockingFastServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncNonblockingFastServer(port); + this.syncFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFastFramedClientSyncNonblockingFastServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncNonblockingFastServer(port); + this.syncFastFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerNoReturnMuti() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + for (int i = 0; i < 5; ++i) { + this.syncFramedClientNoReturn(port); + } + this.waitAndAssertTracesClientSyncServerSync("noReturn", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerNoReturnParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientNoReturn(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("noReturn", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFastFramedClientSyncHsHaServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncFastFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFramedClientSyncHsHaFastServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncHsHaFastServer(port); + this.syncFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFastFramedClientSyncHsHaFastServerNoReturn() throws TException { + int port = super.getPort(); + this.startSyncHsHaFastServer(port); + this.syncFastFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerNoReturnMuti() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientNoReturn(port); + } + + this.waitAndAssertTracesClientSyncServerSync("noReturn", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerNoReturnParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientNoReturn(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("noReturn", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerNoReturn() throws TException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + this.syncFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFastFramedClientAsyncNonblockingServerNoReturn() throws TException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + this.syncFastFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerNoReturnMuti() throws TException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientNoReturn(port); + } + + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerNoReturnParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientNoReturn(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerNoReturn() throws TException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + this.syncFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFastFramedClientAsyncHsHaServerNoReturn() throws TException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + this.syncFastFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFramedClientAsyncHsHaFastServerNoReturn() throws TException { + int port = super.getPort(); + this.startAsyncHsHaFastServer(port); + this.syncFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFastFramedClientAsyncHsHaFastServerNoReturn() throws TException { + int port = super.getPort(); + this.startAsyncHsHaFastServer(port); + this.syncFastFramedClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerNoReturnMuti() throws TException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientNoReturn(port); + } + + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerNoReturnParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientNoReturn(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerNoReturn() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.nonBlockClientNoReturn(port); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerNoReturnMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientNoReturn(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerNoReturnParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientNoReturn(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerNoReturn() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.nonBlockClientNoReturn(port); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerNoReturnMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientNoReturn(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerNoReturnParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientNoReturn(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerNoReturnError() { + Exception error = null; + try { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + this.syncClientNoReturn(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("noReturn", 1); + } + + @Test + public void syncClientSyncNonblockingServerNoReturnError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncClientNoReturn(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("noReturn", 1); + } + + @Test + public void syncClientAsyncHsHaServerNoReturnError() { + Exception error = null; + try { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + this.syncClientNoReturn(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("noReturn", 1); + } + + @Test + public void syncClientSyncHsHaServerNoReturnError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncClientNoReturn(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("noReturn", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerNoReturn() throws TException, IOException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + this.nonBlockClientNoReturn(port); + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerNoReturnMuti() throws TException, IOException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientNoReturn(port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerNoReturnParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientNoReturn(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerNoReturn() throws TException, IOException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + this.nonBlockClientNoReturn(port); + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerNoReturnMuti() throws TException, IOException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientNoReturn(port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerNoReturnParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientNoReturn(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", threadCount); + } + + public void syncClientNoReturn(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.noReturn(1)); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncClientMultiNoReturn(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + this.testing().runWithSpan("parent", () -> client.noReturn(1)); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientNoReturn(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.noReturn_call s) {} + + @Override + public void onError(Exception e) { + Assertions.assertThat(e.getCause().getMessage()) + .isEqualTo("Read call frame size failed"); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.noReturn(1, callback)); + } + + public void syncFramedClientNoReturn(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.noReturn(1)); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFastFramedClientNoReturn(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFastFramedTransport framedTransport = new TFastFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.noReturn(1)); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFramedClientMultiNoReturn(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + this.testing().runWithSpan("parent", () -> client.noReturn(1)); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientNoReturn(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.noReturn(1)); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/OneWayErrorTest.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/OneWayErrorTest.java new file mode 100644 index 000000000000..e8a54935f0f4 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/OneWayErrorTest.java @@ -0,0 +1,1048 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1; + +import io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class OneWayErrorTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerOneWayWithError() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + this.syncClientOneWayWithError(port); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void syncClientSyncSimpleServerOneWayWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientOneWayWithError(port); + } + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void syncClientSyncSimpleServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientOneWayWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerOneWayWithError() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientOneWayWithError(port); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void syncClientSyncThreadPoolServerOneWayWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientOneWayWithError(port); + } + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void syncClientSyncThreadPoolServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientOneWayWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerOneWayWithError() throws TException { + int port = super.getPort(); + this.startMultiSimpleServer(port); + this.syncClientMultiOneWayWithError(port); + this.waitAndAssertTracesClientSyncServerSyncOnewayError( + "oneWayWithError", "syncHelloWorld:oneWayWithError", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerOneWayWithErrorMuti() throws TException { + int port = super.getPort(); + this.startMultiSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiOneWayWithError(port); + } + this.waitAndAssertTracesClientSyncServerSyncOnewayError( + "oneWayWithError", "syncHelloWorld:oneWayWithError", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startMultiSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiOneWayWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOnewayError( + "oneWayWithError", "syncHelloWorld:oneWayWithError", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerOneWayWithErrorError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncClientOneWayWithError(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWayWithError", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerOneWayWithErrorError() { + Exception error = null; + try { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + this.syncClientOneWayWithError(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWayWithError", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerOneWayWithError() throws TException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + this.syncFramedClientOneWayWithError(port); + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerOneWayWithErrorMuti() throws TException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWayWithError(port); + } + + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWayWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerOneWayWithError() throws TException { + int port = super.getPort(); + this.startMultiThreadedSelectorServer(port); + this.syncFramedClientMultiOneWayWithError(port); + this.waitAndAssertTracesClientSyncServerSyncOnewayError( + "oneWayWithError", "syncHelloWorld:oneWayWithError", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerOneWayWithErrorMuti() + throws TException { + int port = super.getPort(); + this.startMultiThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiOneWayWithError(port); + } + + this.waitAndAssertTracesClientSyncServerSyncOnewayError( + "oneWayWithError", "syncHelloWorld:oneWayWithError", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startMultiThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiOneWayWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOnewayError( + "oneWayWithError", "syncHelloWorld:oneWayWithError", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerOneWayWithError() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncFramedClientOneWayWithError(port); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerOneWayWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWayWithError(port); + } + + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWayWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerOneWayWithError() + throws TException, IOException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + this.nonBlockClientOneWayWithError(port); + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerOneWayWithErrorMuti() + throws TException, IOException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWayWithError(port); + } + + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWayWithError(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerOneWayWithError() + throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.nonBlockClientOneWayWithError(port); + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerOneWayWithErrorMuti() + throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWayWithError(port); + } + + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWayWithError(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWayWithError() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncFramedClientOneWayWithError(port); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWayWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWayWithError(port); + } + + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWayWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWayWithError() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncFramedClientOneWayWithError(port); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWayWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWayWithError(port); + } + + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWayWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerOneWayWithError() throws TException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + this.syncFramedClientOneWayWithError(port); + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerOneWayWithErrorMuti() throws TException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWayWithError(port); + } + + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWayWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerOneWayWithError() throws TException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + this.syncFramedClientOneWayWithError(port); + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerOneWayWithErrorMuti() throws TException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWayWithError(port); + } + + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWayWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWayWithError() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.nonBlockClientOneWayWithError(port); + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWayWithErrorMuti() + throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWayWithError(port); + } + + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWayWithError(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWayWithError() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.nonBlockClientOneWayWithError(port); + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWayWithErrorMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWayWithError(port); + } + + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWayWithError(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerOneWayWithErrorError() { + Exception error = null; + try { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + this.syncClientOneWayWithError(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWayWithError", 1); + } + + @Test + public void syncClientSyncNonblockingServerOneWayWithErrorError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncClientOneWayWithError(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWayWithError", 1); + } + + @Test + public void syncClientAsyncHsHaServerOneWayWithErrorError() { + Exception error = null; + try { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + this.syncClientOneWayWithError(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWayWithError", 1); + } + + @Test + public void syncClientSyncHsHaServerOneWayWithErrorError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncClientOneWayWithError(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWayWithError", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerOneWayWithError() throws TException, IOException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + this.nonBlockClientOneWayWithError(port); + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerOneWayWithErrorMuti() + throws TException, IOException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWayWithError(port); + } + + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWayWithError(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerOneWayWithError() throws TException, IOException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + this.nonBlockClientOneWayWithError(port); + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerOneWayWithErrorMuti() throws TException, IOException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWayWithError(port); + } + + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWayWithError(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", threadCount); + } + + public void syncClientOneWayWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.oneWayWithError()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncClientMultiOneWayWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + this.testing().runWithSpan("parent", () -> client.oneWayWithError()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientOneWayWithError(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.oneWayWithError_call no) {} + + @Override + public void onError(Exception e) { + Assertions.assertThat(e.getCause().getMessage()) + .isEqualTo("Read call frame size failed"); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.oneWayWithError(callback)); + } + + public void syncFramedClientOneWayWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.oneWayWithError()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFramedClientMultiOneWayWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + this.testing().runWithSpan("parent", () -> client.oneWayWithError()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientOneWayWithError(int port) throws IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.oneWayWithError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/OneWayTest.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/OneWayTest.java new file mode 100644 index 000000000000..0ffdd646b594 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/OneWayTest.java @@ -0,0 +1,1029 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1; + +import io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class OneWayTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerOneWay() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + this.syncClientOneWay(port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", 1); + } + + @Test + public void syncClientSyncSimpleServerOneWayMuti() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientOneWay(port); + } + this.waitAndAssertTracesClientSyncServerSync("oneWay", 5); + } + + @Test + public void syncClientSyncSimpleServerOneWayParallel() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientOneWay(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerOneWay() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientOneWay(port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", 1); + } + + @Test + public void syncClientSyncThreadPoolServerOneWayMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientOneWay(port); + } + this.waitAndAssertTracesClientSyncServerSync("oneWay", 5); + } + + @Test + public void syncClientSyncThreadPoolServerOneWayParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientOneWay(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerOneWay() throws TException { + int port = super.getPort(); + this.startMultiSimpleServer(port); + this.syncClientMultiOneWay(port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", "syncHelloWorld:oneWay", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerOneWayMuti() throws TException { + int port = super.getPort(); + this.startMultiSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiOneWay(port); + } + this.waitAndAssertTracesClientSyncServerSync("oneWay", "syncHelloWorld:oneWay", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerOneWayParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startMultiSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiOneWay(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", "syncHelloWorld:oneWay", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerOneWayError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncClientOneWay(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWay", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerOneWayError() { + Exception error = null; + try { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + this.syncClientOneWay(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWay", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerOneWay() throws TException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + this.syncFramedClientOneWay(port); + this.waitAndAssertTracesClientSyncServerAsync("oneWay", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerOneWayMuti() throws TException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWay(port); + } + + this.waitAndAssertTracesClientSyncServerAsync("oneWay", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerOneWayParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWay(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("oneWay", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerOneWay() throws TException { + int port = super.getPort(); + this.startMultiThreadedSelectorServer(port); + this.syncFramedClientMultiOneWay(port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", "syncHelloWorld:oneWay", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerOneWayMuti() throws TException { + int port = super.getPort(); + this.startMultiThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiOneWay(port); + } + + this.waitAndAssertTracesClientSyncServerSync("oneWay", "syncHelloWorld:oneWay", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerOneWayParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startMultiThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiOneWay(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", "syncHelloWorld:oneWay", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerOneWay() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncFramedClientOneWay(port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerOneWayMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWay(port); + } + + this.waitAndAssertTracesClientSyncServerSync("oneWay", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerOneWayParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWay(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerOneWay() throws TException, IOException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + this.nonBlockClientOneWay(port); + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerOneWayMuti() throws TException, IOException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWay(port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerOneWayParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWay(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerOneWay() throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.nonBlockClientOneWay(port); + this.waitAndAssertTracesClientAsyncServerSync("oneWay", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerOneWayMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWay(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("oneWay", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerOneWayParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWay(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("oneWay", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWay() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncFramedClientOneWay(port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWayMuti() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWay(port); + } + + this.waitAndAssertTracesClientSyncServerSync("oneWay", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWayParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWay(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWay() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncFramedClientOneWay(port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWayMuti() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWay(port); + } + + this.waitAndAssertTracesClientSyncServerSync("oneWay", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWayParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWay(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerOneWay() throws TException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + this.syncFramedClientOneWay(port); + this.waitAndAssertTracesClientSyncServerAsync("oneWay", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerOneWayMuti() throws TException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWay(port); + } + + this.waitAndAssertTracesClientSyncServerAsync("oneWay", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerOneWayParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWay(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("oneWay", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerOneWay() throws TException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + this.syncFramedClientOneWay(port); + this.waitAndAssertTracesClientSyncServerAsync("oneWay", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerOneWayMuti() throws TException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWay(port); + } + + this.waitAndAssertTracesClientSyncServerAsync("oneWay", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerOneWayParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWay(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("oneWay", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWay() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.nonBlockClientOneWay(port); + this.waitAndAssertTracesClientAsyncServerSync("oneWay", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWayMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWay(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("oneWay", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWayParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWay(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("oneWay", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWay() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.nonBlockClientOneWay(port); + this.waitAndAssertTracesClientAsyncServerSync("oneWay", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWayMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWay(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("oneWay", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWayParallel() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWay(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("oneWay", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerOneWayError() { + Exception error = null; + try { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + this.syncClientOneWay(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWay", 1); + } + + @Test + public void syncClientSyncNonblockingServerOneWayError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncClientOneWay(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWay", 1); + } + + @Test + public void syncClientAsyncHsHaServerOneWayError() { + Exception error = null; + try { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + this.syncClientOneWay(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWay", 1); + } + + @Test + public void syncClientSyncHsHaServerOneWayError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncClientOneWay(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWay", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerOneWay() throws TException, IOException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + this.nonBlockClientOneWay(port); + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerOneWayMuti() throws TException, IOException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWay(port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerOneWayParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWay(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerOneWay() throws TException, IOException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + this.nonBlockClientOneWay(port); + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerOneWayMuti() throws TException, IOException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWay(port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerOneWayParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWay(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", threadCount); + } + + public void syncClientOneWay(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.oneWay()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncClientMultiOneWay(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + this.testing().runWithSpan("parent", () -> client.oneWay()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientOneWay(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.oneWay_call no) {} + + @Override + public void onError(Exception e) { + Assertions.assertThat(e.getCause().getMessage()) + .isEqualTo("Read call frame size failed"); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.oneWay(callback)); + } + + public void syncFramedClientOneWay(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.oneWay()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFramedClientMultiOneWay(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + this.testing().runWithSpan("parent", () -> client.oneWay()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientOneWay(int port) throws IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.oneWay()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/SayHelloTest.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/SayHelloTest.java new file mode 100644 index 000000000000..b3a495c669ab --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/SayHelloTest.java @@ -0,0 +1,1177 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1; + +import com.google.common.base.VerifyException; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFastFramedTransport; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class SayHelloTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + this.syncClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncClientSyncSimpleServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientSayHello(port); + } + this.waitAndAssertTracesClientSyncServerSync("sayHello", 5); + } + + @Test + public void syncClientSyncSimpleServerSayHelloParallel() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientSayHello(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("sayHello", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerSayHello() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncClientSyncThreadPoolServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientSayHello(port); + } + this.waitAndAssertTracesClientSyncServerSync("sayHello", 5); + } + + @Test + public void syncClientSyncThreadPoolServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientSayHello(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("sayHello", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerSayHello() throws TException { + int port = super.getPort(); + this.startMultiSimpleServer(port); + this.syncClientMultiSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", "syncHelloWorld:sayHello", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startMultiSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiSayHello(port); + } + this.waitAndAssertTracesClientSyncServerSync("sayHello", "syncHelloWorld:sayHello", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startMultiSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiSayHello(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "sayHello", "syncHelloWorld:sayHello", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerSayHelloError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncClientSayHello(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("sayHello", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerSayHelloError() { + Exception error = null; + try { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + this.syncClientSayHello(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("sayHello", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerSayHello() throws TException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + this.syncFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFastFramedClientAsyncThreadedSelectorServerSayHello() throws TException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + this.syncFastFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorFastServerSayHello() throws TException { + int port = super.getPort(); + this.startAsyncThreadedSelectorFastServer(port); + this.syncFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFastFramedClientAsyncThreadedSelectorFastServerSayHello() throws TException { + int port = super.getPort(); + this.startAsyncThreadedSelectorFastServer(port); + this.syncFastFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientSayHello(port); + } + + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientSayHello(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerSayHello() throws TException { + int port = super.getPort(); + this.startMultiThreadedSelectorServer(port); + this.syncFramedClientMultiSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", "syncHelloWorld:sayHello", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startMultiThreadedSelectorServer(port); + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiSayHello(port); + } + this.waitAndAssertTracesClientSyncServerSync("sayHello", "syncHelloWorld:sayHello", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startMultiThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiSayHello(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "sayHello", "syncHelloWorld:sayHello", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFastFramedClientSyncThreadedSelectorServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncFastFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorFastServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorFastServer(port); + this.syncFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFastFramedClientSyncThreadedSelectorFastServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorFastServer(port); + this.syncFastFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + for (int i = 0; i < 5; ++i) { + this.syncFramedClientSayHello(port); + } + this.waitAndAssertTracesClientSyncServerSync("sayHello", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientSayHello(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("sayHello", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerSayHello() throws TException, IOException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + this.nonBlockClientSayHello(port); + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerSayHelloMuti() + throws TException, IOException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + for (int i = 0; i < 5; ++i) { + this.nonBlockClientSayHello(port); + } + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientSayHello(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerSayHello() throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.nonBlockClientSayHello(port); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerSayHelloMuti() + throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + for (int i = 0; i < 5; ++i) { + this.nonBlockClientSayHello(port); + } + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientSayHello(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFastFramedClientSyncNonblockingServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncFastFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFramedClientSyncNonblockingFastServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncNonblockingFastServer(port); + this.syncFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFastFramedClientSyncNonblockingFastServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncNonblockingFastServer(port); + this.syncFastFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + for (int i = 0; i < 5; ++i) { + this.syncFramedClientSayHello(port); + } + this.waitAndAssertTracesClientSyncServerSync("sayHello", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientSayHello(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("sayHello", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFastFramedClientSyncHsHaServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncFastFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFramedClientSyncHsHaFastServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncHsHaFastServer(port); + this.syncFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFastFramedClientSyncHsHaFastServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncHsHaFastServer(port); + this.syncFastFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientSayHello(port); + } + + this.waitAndAssertTracesClientSyncServerSync("sayHello", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientSayHello(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("sayHello", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerSayHello() throws TException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + this.syncFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFastFramedClientAsyncNonblockingServerSayHello() throws TException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + this.syncFastFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientSayHello(port); + } + + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientSayHello(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerSayHello() throws TException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + this.syncFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFastFramedClientAsyncHsHaServerSayHello() throws TException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + this.syncFastFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFramedClientAsyncHsHaFastServerSayHello() throws TException { + int port = super.getPort(); + this.startAsyncHsHaFastServer(port); + this.syncFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFastFramedClientAsyncHsHaFastServerSayHello() throws TException { + int port = super.getPort(); + this.startAsyncHsHaFastServer(port); + this.syncFastFramedClientSayHello(port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientSayHello(port); + } + + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientSayHello(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHello() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.nonBlockClientSayHello(port); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHelloMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientSayHello(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientSayHello(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHello() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.nonBlockClientSayHello(port); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHelloMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientSayHello(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientSayHello(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerSayHelloError() { + Exception error = null; + try { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + this.syncClientSayHello(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("sayHello", 1); + } + + @Test + public void syncClientSyncNonblockingServerSayHelloError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncClientSayHello(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("sayHello", 1); + } + + @Test + public void syncClientAsyncHsHaServerSayHelloError() { + Exception error = null; + try { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + this.syncClientSayHello(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("sayHello", 1); + } + + @Test + public void syncClientSyncHsHaServerSayHelloError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncClientSayHello(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("sayHello", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerSayHello() throws TException, IOException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + this.nonBlockClientSayHello(port); + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerSayHelloMuti() throws TException, IOException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientSayHello(port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientSayHello(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerSayHello() throws TException, IOException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + this.nonBlockClientSayHello(port); + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerSayHelloMuti() throws TException, IOException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientSayHello(port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientSayHello(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", threadCount); + } + + public void syncClientSayHello(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.sayHello("US", "Bob")); + Assertions.assertThat(response).isEqualTo("Hello USs' Bob"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncClientMultiSayHello(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + String response = this.testing().runWithSpan("parent", () -> client.sayHello("US", "Bob")); + Assertions.assertThat(response).isEqualTo("Hello USs' Bob"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientSayHello(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.sayHello_call s) { + try { + String result = s.getResult(); + Assertions.assertThat(result).isEqualTo("Hello USs' Bob"); + } catch (TException e) { + throw new VerifyException(e); + } + } + + @Override + public void onError(Exception e) { + Assertions.assertThat(e.getCause().getMessage()) + .isEqualTo("Read call frame size failed"); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.sayHello("US", "Bob", callback)); + } + + public void syncFramedClientSayHello(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.sayHello("US", "Bob")); + Assertions.assertThat(response).isEqualTo("Hello USs' Bob"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFastFramedClientSayHello(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFastFramedTransport framedTransport = new TFastFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.sayHello("US", "Bob")); + Assertions.assertThat(response).isEqualTo("Hello USs' Bob"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFramedClientMultiSayHello(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + String response = this.testing().runWithSpan("parent", () -> client.sayHello("US", "Bob")); + Assertions.assertThat(response).isEqualTo("Hello USs' Bob"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientSayHello(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.sayHello("US", "Bob")); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/TestSaslCallbackHandler.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/TestSaslCallbackHandler.java new file mode 100644 index 000000000000..43688b0e1a7e --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/TestSaslCallbackHandler.java @@ -0,0 +1,47 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1; + +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.NameCallback; +import javax.security.auth.callback.PasswordCallback; +import javax.security.auth.callback.UnsupportedCallbackException; +import javax.security.sasl.AuthorizeCallback; +import javax.security.sasl.RealmCallback; + +public class TestSaslCallbackHandler implements CallbackHandler { + public static final String PRINCIPAL = "thrift-test-principal"; + public static final String REALM = "thrift-test-realm"; + private final String password; + + public TestSaslCallbackHandler(String password) { + this.password = password; + } + + @Override + public void handle(Callback[] callbacks) throws UnsupportedCallbackException { + Callback[] var2 = callbacks; + int var3 = callbacks.length; + + for (int var4 = 0; var4 < var3; ++var4) { + Callback c = var2[var4]; + if (c instanceof NameCallback) { + ((NameCallback) c).setName("thrift-test-principal"); + } else if (c instanceof PasswordCallback) { + ((PasswordCallback) c).setPassword(this.password.toCharArray()); + } else if (c instanceof AuthorizeCallback) { + ((AuthorizeCallback) c).setAuthorized(true); + } else { + if (!(c instanceof RealmCallback)) { + throw new UnsupportedCallbackException(c); + } + + ((RealmCallback) c).setText("thrift-test-realm"); + } + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/ThriftBaseTest.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/ThriftBaseTest.java new file mode 100644 index 000000000000..db75de371ca0 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/ThriftBaseTest.java @@ -0,0 +1,979 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1; + +import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo; +import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.satisfies; + +import com.google.common.base.VerifyException; +import io.opentelemetry.api.common.AttributeKey; +import io.opentelemetry.api.trace.SpanKind; +import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension; +import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.server.ThriftServiceAsyncImpl; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.server.ThriftServiceImpl; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.thrift.ThriftService; +import io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions; +import io.opentelemetry.sdk.testing.assertj.SpanDataAssert; +import io.opentelemetry.sdk.testing.assertj.TraceAssert; +import io.opentelemetry.sdk.trace.data.StatusData; +import io.opentelemetry.semconv.SemanticAttributes; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.nio.charset.Charset; +import java.util.Random; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.function.Consumer; +import java.util.logging.Logger; +import org.apache.thrift.TMultiplexedProcessor; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.server.THsHaServer; +import org.apache.thrift.server.TNonblockingServer; +import org.apache.thrift.server.TServer; +import org.apache.thrift.server.TSimpleServer; +import org.apache.thrift.server.TThreadPoolServer; +import org.apache.thrift.server.TThreadedSelectorServer; +import org.apache.thrift.transport.TFastFramedTransport; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingServerSocket; +import org.apache.thrift.transport.TNonblockingServerTransport; +import org.apache.thrift.transport.TServerSocket; +import org.apache.thrift.transport.TServerTransport; +import org.apache.thrift.transport.TTransportException; +import org.assertj.core.api.AbstractAssert; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.extension.RegisterExtension; + +public abstract class ThriftBaseTest { + private static final Logger logger = Logger.getLogger(ThriftBaseTest.class.getName()); + public TServer server; + public int port = 13100; + + private static final String ASYNC_CLIENT = + "io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.thrift.ThriftService$AsyncClient"; + private static final String SYNC_CLIENT = + "io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.thrift.ThriftService$Client"; + private static final String ASYNC_SERVER = + "io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.server.ThriftServiceAsyncImpl"; + private static final String SYNC_SERVER = + "io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.server.ThriftServiceImpl"; + private static final String PEER_NAME = "localhost"; + private static final String PEER_ADDR = "127.0.0.1"; + + private static final String TRANSPORT_EXCEPTION = + "org.apache.thrift.transport.TTransportException"; + private static final String VERIFY_EXCEPTION = "com.google.common.base.VerifyException"; + // private static final String APP_EXCEPTION = "org.apache.thrift.TApplicationException"; + private static final String IO_EXCEPTION = "java.io.IOException"; + + @RegisterExtension + protected static InstrumentationExtension testing = AgentInstrumentationExtension.create(); + + protected InstrumentationExtension testing() { + return testing; + } + + @BeforeEach + public void before() { + ++this.port; + logger.info( + "before port=" + + this.port + + ", threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.testing().clearData(); + } + + @AfterEach + public void after() { + this.stopServer(); + } + + public int getPort() { + Random random = new Random(); + int newPort = this.port + random.nextInt(2000); + while (portNotRelease(newPort)) { + newPort = this.port + random.nextInt(2000); + } + return newPort; + } + + public static boolean portNotRelease(int port) { + Process process = null; + String pid = null; + try { + process = Runtime.getRuntime().exec("lsof -ti:" + port); + BufferedReader reader = + new BufferedReader( + new InputStreamReader(process.getInputStream(), Charset.defaultCharset())); + pid = reader.readLine(); + } catch (IOException e) { + throw new VerifyException(e); + } + return pid != null && !pid.isEmpty(); + } + + public void startSyncSimpleServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TServerTransport serverTransport = new TServerSocket(port); + this.server = new TSimpleServer(new TServer.Args(serverTransport).processor(processor)); + new Thread( + () -> { + logger.info( + "Starting startSyncSimpleServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startAsyncSimpleServer(int port) throws TTransportException { + ThriftServiceAsyncImpl impl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor processor = + new ThriftService.AsyncProcessor(impl); + TServerTransport serverTransport = new TServerSocket(port); + this.server = new TSimpleServer(new TServer.Args(serverTransport).processor(processor)); + new Thread( + () -> { + logger.info( + "Starting startAsyncSimpleServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startMultiSimpleServer(int port) throws TTransportException { + ThriftServiceImpl syncImpl = new ThriftServiceImpl(); + ThriftService.Processor syncProcessor = + new ThriftService.Processor(syncImpl); + ThriftServiceAsyncImpl asyncImpl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor asyncProcessor = + new ThriftService.AsyncProcessor(asyncImpl); + TMultiplexedProcessor multiplexedProcessor = new TMultiplexedProcessor(); + multiplexedProcessor.registerProcessor("syncHelloWorld", syncProcessor); + multiplexedProcessor.registerProcessor("asyncHelloWorld", asyncProcessor); + TServerTransport serverTransport = new TServerSocket(port); + this.server = + new TSimpleServer(new TServer.Args(serverTransport).processor(multiplexedProcessor)); + new Thread( + () -> { + logger.info( + "Starting startMultiSimpleServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startMultiThreadedSelectorServer(int port) throws TTransportException { + ThriftServiceImpl syncImpl = new ThriftServiceImpl(); + ThriftService.Processor syncProcessor = + new ThriftService.Processor(syncImpl); + ThriftServiceAsyncImpl asyncImpl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor asyncProcessor = + new ThriftService.AsyncProcessor(asyncImpl); + TMultiplexedProcessor multiplexedProcessor = new TMultiplexedProcessor(); + multiplexedProcessor.registerProcessor("syncHelloWorld", syncProcessor); + multiplexedProcessor.registerProcessor("asyncHelloWorld", asyncProcessor); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TThreadedSelectorServer.Args serverArgs = + new TThreadedSelectorServer.Args(transport) + .selectorThreads(5) + .workerThreads(10) + .acceptQueueSizePerThread(20) + .processor(multiplexedProcessor); + this.server = new TThreadedSelectorServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startMultiThreadedSelectorServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startSyncThreadedSelectorServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TThreadedSelectorServer.Args serverArgs = + new TThreadedSelectorServer.Args(transport) + .selectorThreads(5) + .workerThreads(10) + .acceptQueueSizePerThread(20) + .processor(processor); + this.server = new TThreadedSelectorServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startAsyncServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startSyncThreadedSelectorFastServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TThreadedSelectorServer.Args serverArgs = + new TThreadedSelectorServer.Args(transport) + .selectorThreads(5) + .workerThreads(10) + .acceptQueueSizePerThread(20) + .processor(processor) + .transportFactory(new TFastFramedTransport.Factory()); + this.server = new TThreadedSelectorServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startAsyncServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startAsyncThreadedSelectorServer(int port) throws TTransportException { + ThriftServiceAsyncImpl impl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor processor = + new ThriftService.AsyncProcessor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TThreadedSelectorServer.Args serverArgs = + new TThreadedSelectorServer.Args(transport) + .selectorThreads(5) + .workerThreads(10) + .acceptQueueSizePerThread(20) + .processor(processor); + this.server = new TThreadedSelectorServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startNonBlockingServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startAsyncThreadedSelectorFastServer(int port) throws TTransportException { + ThriftServiceAsyncImpl impl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor processor = + new ThriftService.AsyncProcessor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TThreadedSelectorServer.Args serverArgs = + new TThreadedSelectorServer.Args(transport) + .selectorThreads(5) + .workerThreads(10) + .acceptQueueSizePerThread(20) + .processor(processor) + .transportFactory(new TFastFramedTransport.Factory()); + this.server = new TThreadedSelectorServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startNonBlockingServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startSyncNonblockingServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TNonblockingServer.Args serverArgs = + new TNonblockingServer.Args(transport).processor(processor); + this.server = new TNonblockingServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startNonBlockingServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startSyncNonblockingFastServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TNonblockingServer.Args serverArgs = + new TNonblockingServer.Args(transport) + .processor(processor) + .transportFactory(new TFastFramedTransport.Factory()) + .protocolFactory(new TBinaryProtocol.Factory()); + this.server = new TNonblockingServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startNonBlockingServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startAsyncNonblockingServer(int port) throws TTransportException { + ThriftServiceAsyncImpl impl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor processor = + new ThriftService.AsyncProcessor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TNonblockingServer.Args serverArgs = + new TNonblockingServer.Args(transport).processor(processor); + this.server = new TNonblockingServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startNonBlockingServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startAsyncThreadPoolServer(int port) throws TTransportException { + ThriftServiceAsyncImpl impl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor processor = + new ThriftService.AsyncProcessor(impl); + TServerSocket transport = new TServerSocket(port); + TThreadPoolServer.Args serverArgs = + new TThreadPoolServer.Args(transport) + .minWorkerThreads(5) + .maxWorkerThreads(10) + .processor(processor); + TServer server = new TThreadPoolServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startNonBlockingServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + server.serve(); + }) + .start(); + } + + public void startSyncThreadPoolServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TServerSocket transport = new TServerSocket(port); + ExecutorService executor = Executors.newFixedThreadPool(5); + TThreadPoolServer.Args serverArgs = + new TThreadPoolServer.Args(transport).executorService(executor).processor(processor); + TServer server = new TThreadPoolServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startSyncThreadPoolServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + server.serve(); + }) + .start(); + } + + public void startSyncHsHaServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TBinaryProtocol.Factory protocolFactory = new TBinaryProtocol.Factory(); + TFramedTransport.Factory transportFactory = new TFramedTransport.Factory(); + THsHaServer.Args serverArgs = + new THsHaServer.Args(transport) + .processor(processor) + .protocolFactory(protocolFactory) + .transportFactory(transportFactory); + this.server = new THsHaServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startSyncTHsHaServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startSyncHsHaFastServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TBinaryProtocol.Factory protocolFactory = new TBinaryProtocol.Factory(); + TFastFramedTransport.Factory transportFactory = new TFastFramedTransport.Factory(); + THsHaServer.Args serverArgs = + new THsHaServer.Args(transport) + .processor(processor) + .protocolFactory(protocolFactory) + .transportFactory(transportFactory); + this.server = new THsHaServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startSyncTHsHaServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startAsyncHsHaServer(int port) throws TTransportException { + ThriftServiceAsyncImpl impl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor processor = + new ThriftService.AsyncProcessor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TBinaryProtocol.Factory protocolFactory = new TBinaryProtocol.Factory(); + TFramedTransport.Factory transportFactory = new TFramedTransport.Factory(); + THsHaServer.Args serverArgs = + new THsHaServer.Args(transport) + .processor(processor) + .protocolFactory(protocolFactory) + .transportFactory(transportFactory); + this.server = new THsHaServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startAsyncTHsHaServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startAsyncHsHaFastServer(int port) throws TTransportException { + ThriftServiceAsyncImpl impl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor processor = + new ThriftService.AsyncProcessor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TBinaryProtocol.Factory protocolFactory = new TBinaryProtocol.Factory(); + TFastFramedTransport.Factory transportFactory = new TFastFramedTransport.Factory(); + THsHaServer.Args serverArgs = + new THsHaServer.Args(transport) + .processor(processor) + .protocolFactory(protocolFactory) + .transportFactory(transportFactory); + this.server = new THsHaServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startAsyncTHsHaServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void stopServer() { + if (this.server != null) { + this.server.stop(); + } + } + + public void waitAndAssertTracesClientSyncServerSync(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.unset(), + null, + null); + } + + public void waitAndAssertTracesClientSyncServerSync( + String clientMethod, String serverMethod, int count) { + this.baseWaitAndAssertTraces( + clientMethod, + serverMethod, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.unset(), + null, + null); + } + + @SuppressWarnings("UngroupedOverloads") + public void waitAndAssertTracesClientSyncServerSyncWithError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> val.isIn(null, "Internal error processing " + method), + TRANSPORT_EXCEPTION, + SYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientSyncServerSyncWithError( + String clientMethod, String serverMethod, int count) { + this.baseWaitAndAssertTraces( + clientMethod, + serverMethod, + count, + SYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> val.isIn(null, "Internal error processing " + clientMethod), + TRANSPORT_EXCEPTION, + SYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientSyncServerSyncOnewayError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientSyncServerSyncOnewayError( + String clientMethod, String serverMethod, int count) { + this.baseWaitAndAssertTraces( + clientMethod, + serverMethod, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientAsyncServerAsync(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + ASYNC_SERVER, + StatusData.unset(), + null, + null); + } + + public void waitAndAssertTracesClientAsyncServerAsyncError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + ASYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientAsyncServerAsyncWithError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> val.isIn("Read call frame size failed", "fail"), + IO_EXCEPTION, + ASYNC_SERVER, + StatusData.error(), + val -> val.isIn("Read call frame size failed", "fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientAsyncServerSync(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.unset(), + null, + null); + } + + public void waitAndAssertTracesClientAsyncServerSyncWithError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> val.isIn("Read call frame size failed", "Internal error processing " + method), + IO_EXCEPTION, + SYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientAsyncServerSyncOnewayError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) // 测试代码 + public void waitAndAssertTracesClientSyncServerAsync(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + ASYNC_SERVER, + StatusData.unset(), + null, + null); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) // 测试代码 + public void waitAndAssertTracesClientSyncServerAsyncError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + ASYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) // 测试代码 + public void waitAndAssertTracesClientSyncServerAsyncWithError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> val.isIn(null, "fail"), + TRANSPORT_EXCEPTION, + ASYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientSyncNoServer(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> + val.isIn( + null, "Socket is closed by peer.", "java.net.SocketException: Connection reset"), + TRANSPORT_EXCEPTION, + null, + null, + null, + null); + } + + public void waitAndAssertTracesClientSyncNoServerOneway(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + null, + null, + null, + null); + } + + public void waitAndAssertTracesClientSyncNoServerNoSasl(String method, int count) { + this.baseWaitAndAssertTraces( + method, + null, + count, + SYNC_CLIENT, + StatusData.error(), + null, + null, + val -> val.isIn("SASL authentication not complete"), + TRANSPORT_EXCEPTION, + null, + null, + null, + null); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) // 测试代码 + private void baseWaitAndAssertTraces( + String clientMethod, + String serverMethod, + int count, + String clientClass, + StatusData clientStatus, + String peerName, + String peerAddr, + OpenTelemetryAssertions.StringAssertConsumer clientAssertion, + String clientErrorType, + String serverClass, + StatusData serverStatus, + OpenTelemetryAssertions.StringAssertConsumer serviceAssertion, + String serverErrorType) { + Consumer[] consumers = new Consumer[count]; + Consumer traceAssertConsumer; + if (serverClass == null) { + traceAssertConsumer = + trace -> + trace.hasSpansSatisfyingExactly( + span -> span.hasName("parent").hasKind(SpanKind.INTERNAL).hasNoParent(), + clientSpanDataAssertConsumer( + clientMethod, + clientClass, + clientStatus, + trace, + peerName, + peerAddr, + clientAssertion, + clientErrorType)); + } else { + traceAssertConsumer = + trace -> + trace.hasSpansSatisfyingExactly( + span -> span.hasName("parent").hasKind(SpanKind.INTERNAL).hasNoParent(), + clientSpanDataAssertConsumer( + clientMethod, + clientClass, + clientStatus, + trace, + peerName, + peerAddr, + clientAssertion, + clientErrorType), + serverSpanDataAssertConsumer( + serverMethod, + serverClass, + serverStatus, + trace, + serviceAssertion, + serverErrorType)); + } + + for (int i = 0; i < count; ++i) { + consumers[i] = traceAssertConsumer; + } + this.testing().waitAndAssertTraces(consumers); + } + + @SuppressWarnings({"ReturnValueIgnored"}) + private static Consumer clientSpanDataAssertConsumer( + String clientMethod, + String clientClass, + StatusData statusData, + TraceAssert trace, + String peerName, + String peerAddr, + OpenTelemetryAssertions.StringAssertConsumer errorMsgAssertion, + String errorType) { + Consumer consumer = + span -> + span.hasName(clientMethod) + .hasKind(SpanKind.CLIENT) + .hasParent(trace.getSpan(0)) + .hasStatus(statusData) + .hasAttributesSatisfying( + equalTo(AttributeKey.stringKey("net.sock.peer.name"), peerName), + equalTo(AttributeKey.stringKey("net.sock.peer.addr"), peerAddr), + equalTo(SemanticAttributes.RPC_SYSTEM, "thrift"), + equalTo(SemanticAttributes.RPC_SERVICE, clientClass), + equalTo(SemanticAttributes.RPC_METHOD, clientMethod)); + if (statusData == StatusData.error()) { + consumer = + consumer.andThen( + span -> + span.hasEventsSatisfyingExactly( + event -> + event + .hasName(SemanticAttributes.EXCEPTION_EVENT_NAME) + .hasAttributesSatisfyingExactly( + satisfies( + SemanticAttributes.EXCEPTION_MESSAGE, errorMsgAssertion), + satisfies( + AttributeKey.stringKey("exception.stacktrace"), + AbstractAssert::isNotNull), + equalTo(SemanticAttributes.EXCEPTION_TYPE, errorType)))); + } + return consumer; + } + + @SuppressWarnings({"ReturnValueIgnored"}) + private static Consumer serverSpanDataAssertConsumer( + String serverMethod, + String serverClass, + StatusData statusData, + TraceAssert trace, + OpenTelemetryAssertions.StringAssertConsumer errorMsgAssertion, + String errorType) { + Consumer consumer = + span -> + span.hasName(serverMethod) + .hasKind(SpanKind.SERVER) + .hasParent(trace.getSpan(1)) + .hasStatus(statusData) + .hasAttributesSatisfying( + equalTo(AttributeKey.stringKey("net.sock.peer.addr"), "127.0.0.1"), + equalTo(SemanticAttributes.RPC_SYSTEM, "thrift"), + equalTo(SemanticAttributes.RPC_SERVICE, serverClass), + equalTo(SemanticAttributes.RPC_METHOD, serverMethod)); + if (statusData == StatusData.error()) { + consumer = + consumer.andThen( + span -> + span.hasEventsSatisfyingExactly( + event -> + event + .hasName(SemanticAttributes.EXCEPTION_EVENT_NAME) + .hasAttributesSatisfyingExactly( + satisfies( + SemanticAttributes.EXCEPTION_MESSAGE, errorMsgAssertion), + satisfies( + AttributeKey.stringKey("exception.stacktrace"), + AbstractAssert::isNotNull), + equalTo(SemanticAttributes.EXCEPTION_TYPE, errorType)))); + } + return consumer; + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/WithDelayTest.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/WithDelayTest.java new file mode 100644 index 000000000000..12d01e49b9aa --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/WithDelayTest.java @@ -0,0 +1,1046 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1; + +import com.google.common.base.VerifyException; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class WithDelayTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + this.syncClientWithDelay(port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", 1); + } + + @Test + public void syncClientSyncSimpleServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithDelay(port, 2); + } + this.waitAndAssertTracesClientSyncServerSync("withDelay", 5); + } + + @Test + public void syncClientSyncSimpleServerSayHelloParallel() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithDelay(port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withDelay", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerSayHello() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientWithDelay(port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", 1); + } + + @Test + public void syncClientSyncThreadPoolServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithDelay(port, 2); + } + this.waitAndAssertTracesClientSyncServerSync("withDelay", 5); + } + + @Test + public void syncClientSyncThreadPoolServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithDelay(port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withDelay", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerSayHello() throws TException { + int port = super.getPort(); + this.startMultiSimpleServer(port); + this.syncClientMultiWithDelay(port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", "syncHelloWorld:withDelay", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startMultiSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiWithDelay(port, 2); + } + this.waitAndAssertTracesClientSyncServerSync("withDelay", "syncHelloWorld:withDelay", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startMultiSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiWithDelay(port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "withDelay", "syncHelloWorld:withDelay", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerSayHelloError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncClientWithDelay(port, 2); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withDelay", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerSayHelloError() { + Exception error = null; + try { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + this.syncClientWithDelay(port, 2); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withDelay", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerSayHello() throws TException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + this.syncFramedClientWithDelay(port, 2); + this.waitAndAssertTracesClientSyncServerAsync("withDelay", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithDelay(port, 2); + } + + this.waitAndAssertTracesClientSyncServerAsync("withDelay", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithDelay(port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("withDelay", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerSayHello() throws TException { + int port = super.getPort(); + this.startMultiThreadedSelectorServer(port); + this.syncFramedClientMultiWithDelay(port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", "syncHelloWorld:withDelay", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startMultiThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiWithDelay(port, 2); + } + + this.waitAndAssertTracesClientSyncServerSync("withDelay", "syncHelloWorld:withDelay", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startMultiThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiWithDelay(port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "withDelay", "syncHelloWorld:withDelay", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncFramedClientWithDelay(port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithDelay(port, 2); + } + + this.waitAndAssertTracesClientSyncServerSync("withDelay", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithDelay(port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withDelay", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerSayHello() throws TException, IOException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + this.nonBlockClientWithDelay(port, 2); + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerSayHelloMuti() + throws TException, IOException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithDelay(port, 2); + } + + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithDelay(port, 2); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerSayHello() throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.nonBlockClientWithDelay(port, 2); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerSayHelloMuti() + throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithDelay(port, 2); + } + + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithDelay(port, 2); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncFramedClientWithDelay(port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithDelay(port, 2); + } + + this.waitAndAssertTracesClientSyncServerSync("withDelay", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithDelay(port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withDelay", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHello() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncFramedClientWithDelay(port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithDelay(port, 2); + } + + this.waitAndAssertTracesClientSyncServerSync("withDelay", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithDelay(port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withDelay", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerSayHello() throws TException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + this.syncFramedClientWithDelay(port, 2); + this.waitAndAssertTracesClientSyncServerAsync("withDelay", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithDelay(port, 2); + } + + this.waitAndAssertTracesClientSyncServerAsync("withDelay", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithDelay(port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("withDelay", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerSayHello() throws TException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + this.syncFramedClientWithDelay(port, 2); + this.waitAndAssertTracesClientSyncServerAsync("withDelay", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithDelay(port, 2); + } + + this.waitAndAssertTracesClientSyncServerAsync("withDelay", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithDelay(port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("withDelay", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHello() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.nonBlockClientWithDelay(port, 2); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHelloMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithDelay(port, 1); + } + + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithDelay(port, 1); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHello() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.nonBlockClientWithDelay(port, 2); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHelloMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithDelay(port, 2); + } + + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithDelay(port, 2); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerSayHelloError() { + Exception error = null; + try { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + this.syncClientWithDelay(port, 2); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withDelay", 1); + } + + @Test + public void syncClientSyncNonblockingServerSayHelloError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncClientWithDelay(port, 2); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withDelay", 1); + } + + @Test + public void syncClientAsyncHsHaServerSayHelloError() { + Exception error = null; + try { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + this.syncClientWithDelay(port, 2); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withDelay", 1); + } + + @Test + public void syncClientSyncHsHaServerSayHelloError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncClientWithDelay(port, 2); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withDelay", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerSayHello() throws TException, IOException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + this.nonBlockClientWithDelay(port, 2); + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerSayHelloMuti() throws TException, IOException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithDelay(port, 2); + } + + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithDelay(port, 2); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerSayHello() throws TException, IOException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + this.nonBlockClientWithDelay(port, 2); + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerSayHelloMuti() throws TException, IOException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithDelay(port, 2); + } + + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithDelay(port, 2); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", threadCount); + } + + public void syncClientWithDelay(int port, int delay) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.withDelay(delay)); + Assertions.assertThat(response).isEqualTo("delay " + delay); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncClientMultiWithDelay(int port, int delay) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + String response = this.testing().runWithSpan("parent", () -> client.withDelay(delay)); + Assertions.assertThat(response).isEqualTo("delay " + delay); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientWithDelay(int port, int delay) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.withDelay_call s) { + try { + String result = s.getResult(); + Assertions.assertThat(result).isEqualTo("delay " + delay); + } catch (TException e) { + throw new VerifyException(e); + } + } + + @Override + public void onError(Exception e) { + Assertions.assertThat(e.getCause().getMessage()) + .isEqualTo("Read call frame size failed"); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.withDelay(delay, callback)); + } + + public void syncFramedClientWithDelay(int port, int delay) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.withDelay(delay)); + Assertions.assertThat(response).isEqualTo("delay " + delay); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFramedClientMultiWithDelay(int port, int delay) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + String response = this.testing().runWithSpan("parent", () -> client.withDelay(delay)); + Assertions.assertThat(response).isEqualTo("delay " + delay); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientWithDelay(int port, int delay) throws IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withDelay(delay)); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/WithErrorTest.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/WithErrorTest.java new file mode 100644 index 000000000000..d03fa36321c3 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/WithErrorTest.java @@ -0,0 +1,1074 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1; + +import com.google.common.base.VerifyException; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class WithErrorTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerWithError() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + this.syncClientWithError(port); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 1); + } + + @Test + public void syncClientSyncSimpleServerWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithError(port); + } + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 5); + } + + @Test + public void syncClientSyncSimpleServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerWithError() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientWithError(port); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 1); + } + + @Test + public void syncClientSyncThreadPoolServerWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithError(port); + } + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 5); + } + + @Test + public void syncClientSyncThreadPoolServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerWithError() throws TException { + int port = super.getPort(); + this.startMultiSimpleServer(port); + this.syncClientMultiWithError(port); + this.waitAndAssertTracesClientSyncServerSyncWithError( + "withError", "syncHelloWorld:withError", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerWithErrorMuti() throws TException { + int port = super.getPort(); + this.startMultiSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiWithError(port); + } + this.waitAndAssertTracesClientSyncServerSyncWithError( + "withError", "syncHelloWorld:withError", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startMultiSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError( + "withError", "syncHelloWorld:withError", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerWithErrorError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncClientWithError(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServer("withError", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerWithErrorError() { + Exception error = null; + try { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + this.syncClientWithError(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServer("withError", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithError() throws TException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + this.syncFramedClientWithError(port); + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithErrorMuti() throws TException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithError(port); + } + + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithError() throws TException { + int port = super.getPort(); + this.startMultiThreadedSelectorServer(port); + this.syncFramedClientMultiWithError(port); + this.waitAndAssertTracesClientSyncServerSyncWithError( + "withError", "syncHelloWorld:withError", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithErrorMuti() throws TException { + int port = super.getPort(); + this.startMultiThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiWithError(port); + } + + this.waitAndAssertTracesClientSyncServerSyncWithError( + "withError", "syncHelloWorld:withError", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startMultiThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError( + "withError", "syncHelloWorld:withError", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithError() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncFramedClientWithError(port); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithError(port); + } + + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithError() throws TException, IOException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + this.nonBlockClientWithError(port); + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithErrorMuti() + throws TException, IOException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithError(port); + } + + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithError(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithError() throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.nonBlockClientWithError(port); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithErrorMuti() + throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithError(port); + } + + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithError(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithError() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncFramedClientWithError(port); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithError(port); + } + + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerWithError() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncFramedClientWithError(port); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithError(port); + } + + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithError() throws TException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + this.syncFramedClientWithError(port); + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithErrorMuti() throws TException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithError(port); + } + + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithError() throws TException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + this.syncFramedClientWithError(port); + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithErrorMuti() throws TException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithError(port); + } + + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithError() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.nonBlockClientWithError(port); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithErrorMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithError(port); + } + + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithError(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerWithError() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.nonBlockClientWithError(port); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerWithErrorMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithError(port); + } + + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithError(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerWithErrorError() { + Exception error = null; + try { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + this.syncClientWithError(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServer("withError", 1); + } + + @Test + public void syncClientSyncNonblockingServerWithErrorError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncClientWithError(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServer("withError", 1); + } + + @Test + public void syncClientAsyncHsHaServerWithErrorError() { + Exception error = null; + try { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + this.syncClientWithError(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServer("withError", 1); + } + + @Test + public void syncClientSyncHsHaServerWithErrorError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncClientWithError(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServer("withError", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithError() throws TException, IOException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + this.nonBlockClientWithError(port); + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithErrorMuti() throws TException, IOException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithError(port); + } + + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithError(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithError() throws TException, IOException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + this.nonBlockClientWithError(port); + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithErrorMuti() throws TException, IOException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithError(port); + } + + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithError(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", threadCount); + } + + public void syncClientWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncClientMultiWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientWithError(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.withError_call s) { + try { + String result = s.getResult(); + Assertions.assertThat(result).isEqualTo("Hello USs' Bob"); + } catch (TException e) { + throw new VerifyException(e); + } + } + + @Override + public void onError(Exception e) { + Assertions.assertThat(e.getCause().getMessage()) + .isEqualTo("Read call frame size failed"); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.withError(callback)); + } + + public void syncFramedClientWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFramedClientMultiWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientWithError(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/WithStructTest.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/WithStructTest.java new file mode 100644 index 000000000000..32cfdc912cf4 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/WithStructTest.java @@ -0,0 +1,1065 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1; + +import com.google.common.base.VerifyException; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.thrift.Account; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.thrift.ThriftService; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.thrift.User; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.thrift.UserAccount; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class WithStructTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerWithStruct() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + this.syncClientWithStruct(port); + this.waitAndAssertTracesClientSyncServerSync("data", 1); + } + + @Test + public void syncClientSyncSimpleServerWithStructMuti() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithStruct(port); + } + this.waitAndAssertTracesClientSyncServerSync("data", 5); + } + + @Test + public void syncClientSyncSimpleServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithStruct(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerWithStruct() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientWithStruct(port); + this.waitAndAssertTracesClientSyncServerSync("data", 1); + } + + @Test + public void syncClientSyncThreadPoolServerWithStructMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithStruct(port); + } + this.waitAndAssertTracesClientSyncServerSync("data", 5); + } + + @Test + public void syncClientSyncThreadPoolServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithStruct(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerWithStruct() throws TException { + int port = super.getPort(); + this.startMultiSimpleServer(port); + this.syncClientMultiWithStruct(port); + this.waitAndAssertTracesClientSyncServerSync("data", "syncHelloWorld:data", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerWithStructMuti() throws TException { + int port = super.getPort(); + this.startMultiSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiWithStruct(port); + } + this.waitAndAssertTracesClientSyncServerSync("data", "syncHelloWorld:data", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startMultiSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiWithStruct(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", "syncHelloWorld:data", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerWithStructError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncClientWithStruct(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("data", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerWithStructError() { + Exception error = null; + try { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + this.syncClientWithStruct(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("data", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithStruct() throws TException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + this.syncFramedClientWithStruct(port); + this.waitAndAssertTracesClientSyncServerAsync("data", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithStructMuti() throws TException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithStruct(port); + } + + this.waitAndAssertTracesClientSyncServerAsync("data", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithStruct(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("data", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithStruct() throws TException { + int port = super.getPort(); + this.startMultiThreadedSelectorServer(port); + this.syncFramedClientMultiWithStruct(port); + this.waitAndAssertTracesClientSyncServerSync("data", "syncHelloWorld:data", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithStructMuti() throws TException { + int port = super.getPort(); + this.startMultiThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiWithStruct(port); + } + + this.waitAndAssertTracesClientSyncServerSync("data", "syncHelloWorld:data", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startMultiThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiWithStruct(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", "syncHelloWorld:data", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithStruct() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncFramedClientWithStruct(port); + this.waitAndAssertTracesClientSyncServerSync("data", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithStructMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithStruct(port); + } + + this.waitAndAssertTracesClientSyncServerSync("data", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithStruct(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithStruct() throws TException, IOException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + this.nonBlockClientWithStruct(port); + this.waitAndAssertTracesClientAsyncServerAsync("data", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithStructMuti() + throws TException, IOException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithStruct(port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("data", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithStruct(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("data", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithStruct() throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.nonBlockClientWithStruct(port); + this.waitAndAssertTracesClientAsyncServerSync("data", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithStructMuti() + throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithStruct(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("data", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithStruct(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("data", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithStruct() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncFramedClientWithStruct(port); + this.waitAndAssertTracesClientSyncServerSync("data", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithStructMuti() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithStruct(port); + } + + this.waitAndAssertTracesClientSyncServerSync("data", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithStruct(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerWithStruct() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncFramedClientWithStruct(port); + this.waitAndAssertTracesClientSyncServerSync("data", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerWithStructMuti() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithStruct(port); + } + + this.waitAndAssertTracesClientSyncServerSync("data", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithStruct(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithStruct() throws TException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + this.syncFramedClientWithStruct(port); + this.waitAndAssertTracesClientSyncServerAsync("data", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithStructMuti() throws TException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithStruct(port); + } + + this.waitAndAssertTracesClientSyncServerAsync("data", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithStruct(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("data", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithStruct() throws TException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + this.syncFramedClientWithStruct(port); + this.waitAndAssertTracesClientSyncServerAsync("data", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithStructMuti() throws TException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithStruct(port); + } + + this.waitAndAssertTracesClientSyncServerAsync("data", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithStruct(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("data", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithStruct() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.nonBlockClientWithStruct(port); + this.waitAndAssertTracesClientAsyncServerSync("data", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithStructMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithStruct(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("data", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithStruct(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("data", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerWithStruct() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.nonBlockClientWithStruct(port); + this.waitAndAssertTracesClientAsyncServerSync("data", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerWithStructMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithStruct(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("data", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithStruct(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("data", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerWithStructError() { + Exception error = null; + try { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + this.syncClientWithStruct(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("data", 1); + } + + @Test + public void syncClientSyncNonblockingServerWithStructError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncClientWithStruct(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("data", 1); + } + + @Test + public void syncClientAsyncHsHaServerWithStructError() { + Exception error = null; + try { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + this.syncClientWithStruct(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("data", 1); + } + + @Test + public void syncClientSyncHsHaServerWithStructError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncClientWithStruct(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("data", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithStruct() throws TException, IOException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + this.nonBlockClientWithStruct(port); + this.waitAndAssertTracesClientAsyncServerAsync("data", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithStructMuti() throws TException, IOException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithStruct(port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("data", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithStruct(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("data", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithStruct() throws TException, IOException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + this.nonBlockClientWithStruct(port); + this.waitAndAssertTracesClientAsyncServerAsync("data", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithStructMuti() throws TException, IOException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithStruct(port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("data", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithStruct(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("data", threadCount); + } + + public void syncClientWithStruct(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + UserAccount response = this.testing().runWithSpan("parent", () -> client.data(user, account)); + Assertions.assertThat(response.user).isEqualTo(user); + Assertions.assertThat(response.account).isEqualTo(account); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncClientMultiWithStruct(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + UserAccount response = this.testing().runWithSpan("parent", () -> client.data(user, account)); + Assertions.assertThat(response.user).isEqualTo(user); + Assertions.assertThat(response.account).isEqualTo(account); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientWithStruct(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.data_call response) { + try { + UserAccount result = response.getResult(); + Assertions.assertThat(result.user).isEqualTo(user); + Assertions.assertThat(result.account).isEqualTo(account); + } catch (TException e) { + throw new VerifyException(e); + } + } + + @Override + public void onError(Exception e) { + Assertions.assertThat(e.getCause().getMessage()) + .isEqualTo("Read call frame size failed"); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.data(user, account, callback)); + } + + public void syncFramedClientWithStruct(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + UserAccount response = this.testing().runWithSpan("parent", () -> client.data(user, account)); + Assertions.assertThat(response.user).isEqualTo(user); + Assertions.assertThat(response.account).isEqualTo(account); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFramedClientMultiWithStruct(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + UserAccount response = this.testing().runWithSpan("parent", () -> client.data(user, account)); + Assertions.assertThat(response.user).isEqualTo(user); + Assertions.assertThat(response.account).isEqualTo(account); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientWithStruct(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + UserAccount response = this.testing().runWithSpan("parent", () -> client.data(user, account)); + Assertions.assertThat(response.user).isEqualTo(user); + Assertions.assertThat(response.account).isEqualTo(account); + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/WithoutArgsTest.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/WithoutArgsTest.java new file mode 100644 index 000000000000..e9679e96aedd --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/WithoutArgsTest.java @@ -0,0 +1,1051 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1; + +import com.google.common.base.VerifyException; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class WithoutArgsTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerWithoutArgs() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + this.syncClientWithoutArgs(port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 1); + } + + @Test + public void syncClientSyncSimpleServerWithoutArgsMuti() throws TException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithoutArgs(port); + } + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 5); + } + + @Test + public void syncClientSyncSimpleServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithoutArgs(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerWithoutArgs() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientWithoutArgs(port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 1); + } + + @Test + public void syncClientSyncThreadPoolServerWithoutArgsMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithoutArgs(port); + } + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 5); + } + + @Test + public void syncClientSyncThreadPoolServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithoutArgs(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerWithoutArgs() throws TException { + int port = super.getPort(); + this.startMultiSimpleServer(port); + this.syncClientMultiWithoutArgs(port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", "syncHelloWorld:withoutArgs", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerWithoutArgsMuti() throws TException { + int port = super.getPort(); + this.startMultiSimpleServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiWithoutArgs(port); + } + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", "syncHelloWorld:withoutArgs", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startMultiSimpleServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiWithoutArgs(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "withoutArgs", "syncHelloWorld:withoutArgs", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerWithoutArgsError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncClientWithoutArgs(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withoutArgs", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerWithoutArgsError() { + Exception error = null; + try { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + this.syncClientWithoutArgs(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withoutArgs", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithoutArgs() throws TException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + this.syncFramedClientWithoutArgs(port); + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithoutArgsMuti() throws TException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithoutArgs(port); + } + + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithoutArgs(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithoutArgs() throws TException { + int port = super.getPort(); + this.startMultiThreadedSelectorServer(port); + this.syncFramedClientMultiWithoutArgs(port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", "syncHelloWorld:withoutArgs", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithoutArgsMuti() throws TException { + int port = super.getPort(); + this.startMultiThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiWithoutArgs(port); + } + + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", "syncHelloWorld:withoutArgs", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startMultiThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiWithoutArgs(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "withoutArgs", "syncHelloWorld:withoutArgs", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithoutArgs() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.syncFramedClientWithoutArgs(port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithoutArgsMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithoutArgs(port); + } + + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithoutArgs(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithoutArgs() + throws TException, IOException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + this.nonBlockClientWithoutArgs(port); + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithoutArgsMuti() + throws TException, IOException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithoutArgs(port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithoutArgs(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithoutArgs() throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + this.nonBlockClientWithoutArgs(port); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithoutArgsMuti() + throws TException, IOException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithoutArgs(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadedSelectorServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithoutArgs(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithoutArgs() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncFramedClientWithoutArgs(port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithoutArgsMuti() throws TException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithoutArgs(port); + } + + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithoutArgs(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerWithoutArgs() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncFramedClientWithoutArgs(port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerWithoutArgsMuti() throws TException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithoutArgs(port); + } + + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithoutArgs(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithoutArgs() throws TException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + this.syncFramedClientWithoutArgs(port); + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithoutArgsMuti() throws TException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithoutArgs(port); + } + + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithoutArgs(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithoutArgs() throws TException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + this.syncFramedClientWithoutArgs(port); + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithoutArgsMuti() throws TException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithoutArgs(port); + } + + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithoutArgs(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithoutArgs() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.nonBlockClientWithoutArgs(port); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithoutArgsMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithoutArgs(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithoutArgs(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerWithoutArgs() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.nonBlockClientWithoutArgs(port); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerWithoutArgsMuti() throws TException, IOException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithoutArgs(port); + } + + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithoutArgs(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerWithoutArgsError() { + Exception error = null; + try { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + this.syncClientWithoutArgs(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withoutArgs", 1); + } + + @Test + public void syncClientSyncNonblockingServerWithoutArgsError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncNonblockingServer(port); + this.syncClientWithoutArgs(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withoutArgs", 1); + } + + @Test + public void syncClientAsyncHsHaServerWithoutArgsError() { + Exception error = null; + try { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + this.syncClientWithoutArgs(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withoutArgs", 1); + } + + @Test + public void syncClientSyncHsHaServerWithoutArgsError() { + Exception error = null; + try { + int port = super.getPort(); + this.startSyncHsHaServer(port); + this.syncClientWithoutArgs(port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withoutArgs", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithoutArgs() throws TException, IOException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + this.nonBlockClientWithoutArgs(port); + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithoutArgsMuti() throws TException, IOException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithoutArgs(port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncNonblockingServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithoutArgs(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithoutArgs() throws TException, IOException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + this.nonBlockClientWithoutArgs(port); + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithoutArgsMuti() throws TException, IOException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithoutArgs(port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startAsyncHsHaServer(port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithoutArgs(port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", threadCount); + } + + public void syncClientWithoutArgs(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.withoutArgs()); + Assertions.assertThat(response).isEqualTo("no args"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncClientMultiWithoutArgs(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + String response = this.testing().runWithSpan("parent", () -> client.withoutArgs()); + Assertions.assertThat(response).isEqualTo("no args"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientWithoutArgs(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.withoutArgs_call s) { + try { + String result = s.getResult(); + Assertions.assertThat(result).isEqualTo("no args"); + } catch (TException e) { + throw new VerifyException(e); + } + } + + @Override + public void onError(Exception e) { + Assertions.assertThat(e.getCause().getMessage()) + .isEqualTo("Read call frame size failed"); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.withoutArgs(callback)); + } + + public void syncFramedClientWithoutArgs(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.withoutArgs()); + Assertions.assertThat(response).isEqualTo("no args"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFramedClientMultiWithoutArgs(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + String response = this.testing().runWithSpan("parent", () -> client.withoutArgs()); + Assertions.assertThat(response).isEqualTo("no args"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientWithoutArgs(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withoutArgs()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ThriftServiceAsyncImpl.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ThriftServiceAsyncImpl.java new file mode 100644 index 000000000000..b88a9dc9a6d0 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ThriftServiceAsyncImpl.java @@ -0,0 +1,75 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.server; + +import com.google.common.base.VerifyException; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.thrift.Account; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.thrift.ThriftService; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.thrift.User; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.thrift.UserAccount; +import java.util.concurrent.TimeUnit; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused", "all"}) +public class ThriftServiceAsyncImpl implements ThriftService.AsyncIface { + public ThriftServiceAsyncImpl() {} + + @Override + public void sayHello(String zone, String name, AsyncMethodCallback resultHandler) + throws TException { + resultHandler.onComplete("Hello " + zone + "s' " + name); + } + + @Override + public void withDelay(int delay, AsyncMethodCallback resultHandler) throws TException { + try { + TimeUnit.SECONDS.sleep(delay); + } catch (InterruptedException var4) { + InterruptedException e = var4; + throw new VerifyException(e); + } + + resultHandler.onComplete("delay " + delay); + } + + @Override + public void withoutArgs(AsyncMethodCallback resultHandler) throws TException { + resultHandler.onComplete("no args"); + } + + @Override + public void withError(AsyncMethodCallback resultHandler) throws TException { + throw new VerifyException("fail"); + } + + @Override + public void withCollisioin(String input, AsyncMethodCallback resultHandler) throws TException { + resultHandler.onComplete(input); + } + + @Override + public void noReturn(int delay, AsyncMethodCallback resultHandler) throws TException { + resultHandler.onComplete(null); + } + + @Override + public void oneWayHasArgs(int delay, AsyncMethodCallback resultHandler) throws TException {} + + @Override + public void oneWay(AsyncMethodCallback resultHandler) throws TException {} + + @Override + public void oneWayWithError(AsyncMethodCallback resultHandler) throws TException { + throw new VerifyException("fail"); + } + + @Override + public void data(User user, Account account, AsyncMethodCallback resultHandler) + throws TException { + resultHandler.onComplete(new UserAccount(user, account)); + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ThriftServiceImpl.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ThriftServiceImpl.java new file mode 100644 index 000000000000..67b4cbf7ef3d --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/server/ThriftServiceImpl.java @@ -0,0 +1,71 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.server; + +import com.google.common.base.VerifyException; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.thrift.Account; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.thrift.ThriftService; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.thrift.User; +import io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.thrift.UserAccount; +import java.util.concurrent.TimeUnit; +import org.apache.thrift.TException; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused", "all"}) +public class ThriftServiceImpl implements ThriftService.Iface { + + public ThriftServiceImpl() {} + + @Override + public String sayHello(String zone, String name) { + return "Hello " + zone + "s' " + name; + } + + @Override + public String withDelay(int delay) { + try { + TimeUnit.SECONDS.sleep((long) delay); + } catch (InterruptedException var3) { + InterruptedException e = var3; + throw new VerifyException(e); + } + + return "delay " + delay; + } + + @Override + public String withoutArgs() { + return "no args"; + } + + @Override + public String withError() { + throw new VerifyException("fail"); + } + + @Override + public String withCollisioin(String input) { + return input; + } + + @Override + public void noReturn(int delay) throws TException {} + + @Override + public void oneWayHasArgs(int delay) throws TException {} + + @Override + public void oneWay() {} + + @Override + public void oneWayWithError() { + throw new VerifyException("fail"); + } + + @Override + public UserAccount data(User user, Account account) { + return new UserAccount(user, account); + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/thrift/Account.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/thrift/Account.java new file mode 100644 index 000000000000..94893048b070 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/thrift/Account.java @@ -0,0 +1,478 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.thrift; + +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "all"}) +public class Account + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("Account"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField CARD_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "cardId", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new AccountStandardSchemeFactory()); + schemes.put(TupleScheme.class, new AccountTupleSchemeFactory()); + } + + public String zone; // required + public String cardId; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + CARD_ID((short) 2, "cardId"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // CARD_ID + return CARD_ID; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.CARD_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "cardId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Account.class, metaDataMap); + } + + public Account() {} + + public Account(String zone, String cardId) { + this(); + this.zone = zone; + this.cardId = cardId; + } + + /** Performs a deep copy on other. */ + public Account(Account other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetCardId()) { + this.cardId = other.cardId; + } + } + + public Account deepCopy() { + return new Account(this); + } + + @Override + public void clear() { + this.zone = null; + this.cardId = null; + } + + public String getZone() { + return this.zone; + } + + public Account setZone(String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + public String getCardId() { + return this.cardId; + } + + public Account setCardId(String cardId) { + this.cardId = cardId; + return this; + } + + public void unsetCardId() { + this.cardId = null; + } + + /** Returns true if field cardId is set (has been assigned a value) and false otherwise */ + public boolean isSetCardId() { + return this.cardId != null; + } + + public void setCardIdIsSet(boolean value) { + if (!value) { + this.cardId = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((String) value); + } + break; + + case CARD_ID: + if (value == null) { + unsetCardId(); + } else { + setCardId((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case CARD_ID: + return getCardId(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case CARD_ID: + return isSetCardId(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof Account) return this.equals((Account) that); + return false; + } + + public boolean equals(Account that) { + if (that == null) return false; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_cardId = true && this.isSetCardId(); + boolean that_present_cardId = true && that.isSetCardId(); + if (this_present_cardId || that_present_cardId) { + if (!(this_present_cardId && that_present_cardId)) return false; + if (!this.cardId.equals(that.cardId)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(Account other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetZone()).compareTo(other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetCardId()).compareTo(other.isSetCardId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCardId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cardId, other.cardId); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("Account("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("cardId:"); + if (this.cardId == null) { + sb.append("null"); + } else { + sb.append(this.cardId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (zone == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'zone' was not present! Struct: " + toString()); + } + if (cardId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'cardId' was not present! Struct: " + toString()); + } + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class AccountStandardSchemeFactory implements SchemeFactory { + public AccountStandardScheme getScheme() { + return new AccountStandardScheme(); + } + } + + private static class AccountStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // CARD_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, Account struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.cardId != null) { + oprot.writeFieldBegin(CARD_ID_FIELD_DESC); + oprot.writeString(struct.cardId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class AccountTupleSchemeFactory implements SchemeFactory { + public AccountTupleScheme getScheme() { + return new AccountTupleScheme(); + } + } + + private static class AccountTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeString(struct.zone); + oprot.writeString(struct.cardId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/thrift/ThriftService.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/thrift/ThriftService.java new file mode 100644 index 000000000000..a842fbbf63b4 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/thrift/ThriftService.java @@ -0,0 +1,7438 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.thrift; + +import java.util.BitSet; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "all"}) +public class ThriftService { + + public interface Iface { + + public String sayHello(String zone, String name) throws TException; + + public String withDelay(int delay) throws TException; + + public String withoutArgs() throws TException; + + public String withError() throws TException; + + public String withCollisioin(String input) throws TException; + + public void noReturn(int delay) throws TException; + + public void oneWayHasArgs(int delay) throws TException; + + public void oneWay() throws TException; + + public void oneWayWithError() throws TException; + + public UserAccount data(User user, Account account) throws TException; + } + + public interface AsyncIface { + + public void sayHello(String zone, String name, AsyncMethodCallback resultHandler) + throws TException; + + public void withDelay(int delay, AsyncMethodCallback resultHandler) throws TException; + + public void withoutArgs(AsyncMethodCallback resultHandler) throws TException; + + public void withError(AsyncMethodCallback resultHandler) throws TException; + + public void withCollisioin(String input, AsyncMethodCallback resultHandler) throws TException; + + public void noReturn(int delay, AsyncMethodCallback resultHandler) throws TException; + + public void oneWayHasArgs(int delay, AsyncMethodCallback resultHandler) throws TException; + + public void oneWay(AsyncMethodCallback resultHandler) throws TException; + + public void oneWayWithError(AsyncMethodCallback resultHandler) throws TException; + + public void data(User user, Account account, AsyncMethodCallback resultHandler) + throws TException; + } + + public static class Client extends org.apache.thrift.TServiceClient implements Iface { + public static class Factory implements org.apache.thrift.TServiceClientFactory { + public Factory() {} + + public Client getClient(org.apache.thrift.protocol.TProtocol prot) { + return new Client(prot); + } + + public Client getClient( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + return new Client(iprot, oprot); + } + } + + public Client(org.apache.thrift.protocol.TProtocol prot) { + super(prot, prot); + } + + public Client( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + super(iprot, oprot); + } + + public String sayHello(String zone, String name) throws TException { + send_sayHello(zone, name); + return recv_sayHello(); + } + + public void send_sayHello(String zone, String name) throws TException { + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + sendBase("sayHello", args); + } + + public String recv_sayHello() throws TException { + sayHello_result result = new sayHello_result(); + receiveBase(result, "sayHello"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "sayHello failed: unknown result"); + } + + public String withDelay(int delay) throws TException { + send_withDelay(delay); + return recv_withDelay(); + } + + public void send_withDelay(int delay) throws TException { + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + sendBase("withDelay", args); + } + + public String recv_withDelay() throws TException { + withDelay_result result = new withDelay_result(); + receiveBase(result, "withDelay"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withDelay failed: unknown result"); + } + + public String withoutArgs() throws TException { + send_withoutArgs(); + return recv_withoutArgs(); + } + + public void send_withoutArgs() throws TException { + withoutArgs_args args = new withoutArgs_args(); + sendBase("withoutArgs", args); + } + + public String recv_withoutArgs() throws TException { + withoutArgs_result result = new withoutArgs_result(); + receiveBase(result, "withoutArgs"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withoutArgs failed: unknown result"); + } + + public String withError() throws TException { + send_withError(); + return recv_withError(); + } + + public void send_withError() throws TException { + withError_args args = new withError_args(); + sendBase("withError", args); + } + + public String recv_withError() throws TException { + withError_result result = new withError_result(); + receiveBase(result, "withError"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withError failed: unknown result"); + } + + public String withCollisioin(String input) throws TException { + send_withCollisioin(input); + return recv_withCollisioin(); + } + + public void send_withCollisioin(String input) throws TException { + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + sendBase("withCollisioin", args); + } + + public String recv_withCollisioin() throws TException { + withCollisioin_result result = new withCollisioin_result(); + receiveBase(result, "withCollisioin"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withCollisioin failed: unknown result"); + } + + public void noReturn(int delay) throws TException { + send_noReturn(delay); + recv_noReturn(); + } + + public void send_noReturn(int delay) throws TException { + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + sendBase("noReturn", args); + } + + public void recv_noReturn() throws TException { + noReturn_result result = new noReturn_result(); + receiveBase(result, "noReturn"); + return; + } + + public void oneWayHasArgs(int delay) throws TException { + send_oneWayHasArgs(delay); + } + + public void send_oneWayHasArgs(int delay) throws TException { + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + sendBase("oneWayHasArgs", args); + } + + public void oneWay() throws TException { + send_oneWay(); + } + + public void send_oneWay() throws TException { + oneWay_args args = new oneWay_args(); + sendBase("oneWay", args); + } + + public void oneWayWithError() throws TException { + send_oneWayWithError(); + } + + public void send_oneWayWithError() throws TException { + oneWayWithError_args args = new oneWayWithError_args(); + sendBase("oneWayWithError", args); + } + + public UserAccount data(User user, Account account) throws TException { + send_data(user, account); + return recv_data(); + } + + public void send_data(User user, Account account) throws TException { + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + sendBase("data", args); + } + + public UserAccount recv_data() throws TException { + data_result result = new data_result(); + receiveBase(result, "data"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, "data failed: unknown result"); + } + } + + public static class AsyncClient extends org.apache.thrift.async.TAsyncClient + implements AsyncIface { + public static class Factory + implements org.apache.thrift.async.TAsyncClientFactory { + private org.apache.thrift.async.TAsyncClientManager clientManager; + private org.apache.thrift.protocol.TProtocolFactory protocolFactory; + + public Factory( + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.protocol.TProtocolFactory protocolFactory) { + this.clientManager = clientManager; + this.protocolFactory = protocolFactory; + } + + public AsyncClient getAsyncClient( + org.apache.thrift.transport.TNonblockingTransport transport) { + return new AsyncClient(protocolFactory, clientManager, transport); + } + } + + public AsyncClient( + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.transport.TNonblockingTransport transport) { + super(protocolFactory, clientManager, transport); + } + + public void sayHello(String zone, String name, AsyncMethodCallback resultHandler) + throws TException { + checkReady(); + sayHello_call method_call = + new sayHello_call(zone, name, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class sayHello_call extends org.apache.thrift.async.TAsyncMethodCall { + private String zone; + private String name; + + public sayHello_call( + String zone, + String name, + AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + this.zone = zone; + this.name = name; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "sayHello", org.apache.thrift.protocol.TMessageType.CALL, 0)); + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_sayHello(); + } + } + + public void withDelay(int delay, AsyncMethodCallback resultHandler) throws TException { + checkReady(); + withDelay_call method_call = + new withDelay_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withDelay_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public withDelay_call( + int delay, + AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withDelay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withDelay(); + } + } + + public void withoutArgs(AsyncMethodCallback resultHandler) throws TException { + checkReady(); + withoutArgs_call method_call = + new withoutArgs_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withoutArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + public withoutArgs_call( + AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withoutArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withoutArgs_args args = new withoutArgs_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withoutArgs(); + } + } + + public void withError(AsyncMethodCallback resultHandler) throws TException { + checkReady(); + withError_call method_call = + new withError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withError_call extends org.apache.thrift.async.TAsyncMethodCall { + public withError_call( + AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withError_args args = new withError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withError(); + } + } + + public void withCollisioin(String input, AsyncMethodCallback resultHandler) throws TException { + checkReady(); + withCollisioin_call method_call = + new withCollisioin_call(input, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withCollisioin_call extends org.apache.thrift.async.TAsyncMethodCall { + private String input; + + public withCollisioin_call( + String input, + AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + this.input = input; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withCollisioin", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withCollisioin(); + } + } + + public void noReturn(int delay, AsyncMethodCallback resultHandler) throws TException { + checkReady(); + noReturn_call method_call = + new noReturn_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class noReturn_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public noReturn_call( + int delay, + AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "noReturn", org.apache.thrift.protocol.TMessageType.CALL, 0)); + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + (new Client(prot)).recv_noReturn(); + } + } + + public void oneWayHasArgs(int delay, AsyncMethodCallback resultHandler) throws TException { + checkReady(); + oneWayHasArgs_call method_call = + new oneWayHasArgs_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayHasArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public oneWayHasArgs_call( + int delay, + AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, true); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayHasArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void oneWay(AsyncMethodCallback resultHandler) throws TException { + checkReady(); + oneWay_call method_call = + new oneWay_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWay_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWay_call( + AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + oneWay_args args = new oneWay_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void oneWayWithError(AsyncMethodCallback resultHandler) throws TException { + checkReady(); + oneWayWithError_call method_call = + new oneWayWithError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayWithError_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWayWithError_call( + AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayWithError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + oneWayWithError_args args = new oneWayWithError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void data(User user, Account account, AsyncMethodCallback resultHandler) + throws TException { + checkReady(); + data_call method_call = + new data_call(user, account, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class data_call extends org.apache.thrift.async.TAsyncMethodCall { + private User user; + private Account account; + + public data_call( + User user, + Account account, + AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + this.user = user; + this.account = account; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "data", org.apache.thrift.protocol.TMessageType.CALL, 0)); + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + args.write(prot); + prot.writeMessageEnd(); + } + + public UserAccount getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_data(); + } + } + } + + public static class Processor extends org.apache.thrift.TBaseProcessor + implements org.apache.thrift.TProcessor { + private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); + + public Processor(I iface) { + super( + iface, + getProcessMap( + new HashMap< + String, + org.apache.thrift.ProcessFunction>())); + } + + protected Processor( + I iface, + Map> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + Map> + getProcessMap( + Map> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.ProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + protected boolean isOneway() { + return false; + } + + public sayHello_result getResult(I iface, sayHello_args args) throws TException { + sayHello_result result = new sayHello_result(); + result.success = iface.sayHello(args.zone, args.name); + return result; + } + } + + public static class withDelay + extends org.apache.thrift.ProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + protected boolean isOneway() { + return false; + } + + public withDelay_result getResult(I iface, withDelay_args args) throws TException { + withDelay_result result = new withDelay_result(); + result.success = iface.withDelay(args.delay); + return result; + } + } + + public static class withoutArgs + extends org.apache.thrift.ProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + protected boolean isOneway() { + return false; + } + + public withoutArgs_result getResult(I iface, withoutArgs_args args) throws TException { + withoutArgs_result result = new withoutArgs_result(); + result.success = iface.withoutArgs(); + return result; + } + } + + public static class withError + extends org.apache.thrift.ProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + protected boolean isOneway() { + return false; + } + + public withError_result getResult(I iface, withError_args args) throws TException { + withError_result result = new withError_result(); + result.success = iface.withError(); + return result; + } + } + + public static class withCollisioin + extends org.apache.thrift.ProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + protected boolean isOneway() { + return false; + } + + public withCollisioin_result getResult(I iface, withCollisioin_args args) throws TException { + withCollisioin_result result = new withCollisioin_result(); + result.success = iface.withCollisioin(args.input); + return result; + } + } + + public static class noReturn + extends org.apache.thrift.ProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + protected boolean isOneway() { + return false; + } + + public noReturn_result getResult(I iface, noReturn_args args) throws TException { + noReturn_result result = new noReturn_result(); + iface.noReturn(args.delay); + return result; + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.ProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + protected boolean isOneway() { + return true; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayHasArgs_args args) throws TException { + iface.oneWayHasArgs(args.delay); + return null; + } + } + + public static class oneWay + extends org.apache.thrift.ProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + protected boolean isOneway() { + return true; + } + + public org.apache.thrift.TBase getResult(I iface, oneWay_args args) throws TException { + iface.oneWay(); + return null; + } + } + + public static class oneWayWithError + extends org.apache.thrift.ProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + protected boolean isOneway() { + return true; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayWithError_args args) + throws TException { + iface.oneWayWithError(); + return null; + } + } + + public static class data + extends org.apache.thrift.ProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + protected boolean isOneway() { + return false; + } + + public data_result getResult(I iface, data_args args) throws TException { + data_result result = new data_result(); + result.success = iface.data(args.user, args.account); + return result; + } + } + } + + public static class AsyncProcessor + extends org.apache.thrift.TBaseAsyncProcessor { + private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); + + public AsyncProcessor(I iface) { + super( + iface, + getProcessMap( + new HashMap< + String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>>())); + } + + protected AsyncProcessor( + I iface, + Map> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + Map> + getProcessMap( + Map< + String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.AsyncProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(String o) { + sayHello_result result = new sayHello_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + sayHello_result result = new sayHello_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, sayHello_args args, AsyncMethodCallback resultHandler) + throws TException { + iface.sayHello(args.zone, args.name, resultHandler); + } + } + + public static class withDelay + extends org.apache.thrift.AsyncProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(String o) { + withDelay_result result = new withDelay_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + withDelay_result result = new withDelay_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, withDelay_args args, AsyncMethodCallback resultHandler) + throws TException { + iface.withDelay(args.delay, resultHandler); + } + } + + public static class withoutArgs + extends org.apache.thrift.AsyncProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(String o) { + withoutArgs_result result = new withoutArgs_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + withoutArgs_result result = new withoutArgs_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, withoutArgs_args args, AsyncMethodCallback resultHandler) + throws TException { + iface.withoutArgs(resultHandler); + } + } + + public static class withError + extends org.apache.thrift.AsyncProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(String o) { + withError_result result = new withError_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + withError_result result = new withError_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, withError_args args, AsyncMethodCallback resultHandler) + throws TException { + iface.withError(resultHandler); + } + } + + public static class withCollisioin + extends org.apache.thrift.AsyncProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(String o) { + withCollisioin_result result = new withCollisioin_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + withCollisioin_result result = new withCollisioin_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, withCollisioin_args args, AsyncMethodCallback resultHandler) + throws TException { + iface.withCollisioin(args.input, resultHandler); + } + } + + public static class noReturn + extends org.apache.thrift.AsyncProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Void o) { + noReturn_result result = new noReturn_result(); + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + noReturn_result result = new noReturn_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, noReturn_args args, AsyncMethodCallback resultHandler) + throws TException { + iface.noReturn(args.delay, resultHandler); + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.AsyncProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(Exception e) {} + }; + } + + protected boolean isOneway() { + return true; + } + + public void start(I iface, oneWayHasArgs_args args, AsyncMethodCallback resultHandler) + throws TException { + iface.oneWayHasArgs(args.delay, resultHandler); + } + } + + public static class oneWay + extends org.apache.thrift.AsyncProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(Exception e) {} + }; + } + + protected boolean isOneway() { + return true; + } + + public void start(I iface, oneWay_args args, AsyncMethodCallback resultHandler) + throws TException { + iface.oneWay(resultHandler); + } + } + + public static class oneWayWithError + extends org.apache.thrift.AsyncProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(Exception e) {} + }; + } + + protected boolean isOneway() { + return true; + } + + public void start(I iface, oneWayWithError_args args, AsyncMethodCallback resultHandler) + throws TException { + iface.oneWayWithError(resultHandler); + } + } + + public static class data + extends org.apache.thrift.AsyncProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(UserAccount o) { + data_result result = new data_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + data_result result = new data_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, data_args args, AsyncMethodCallback resultHandler) + throws TException { + iface.data(args.user, args.account, resultHandler); + } + } + } + + public static class sayHello_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_args"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new sayHello_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new sayHello_argsTupleSchemeFactory()); + } + + public String zone; // required + public String name; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + NAME((short) 2, "name"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // NAME + return NAME; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_args.class, metaDataMap); + } + + public sayHello_args() {} + + public sayHello_args(String zone, String name) { + this(); + this.zone = zone; + this.name = name; + } + + /** Performs a deep copy on other. */ + public sayHello_args(sayHello_args other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetName()) { + this.name = other.name; + } + } + + public sayHello_args deepCopy() { + return new sayHello_args(this); + } + + @Override + public void clear() { + this.zone = null; + this.name = null; + } + + public String getZone() { + return this.zone; + } + + public sayHello_args setZone(String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + public String getName() { + return this.name; + } + + public sayHello_args setName(String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((String) value); + } + break; + + case NAME: + if (value == null) { + unsetName(); + } else { + setName((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case NAME: + return getName(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case NAME: + return isSetName(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof sayHello_args) return this.equals((sayHello_args) that); + return false; + } + + public boolean equals(sayHello_args that) { + if (that == null) return false; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(sayHello_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetZone()).compareTo(other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("sayHello_args("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_argsStandardSchemeFactory implements SchemeFactory { + public sayHello_argsStandardScheme getScheme() { + return new sayHello_argsStandardScheme(); + } + } + + private static class sayHello_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_argsTupleSchemeFactory implements SchemeFactory { + public sayHello_argsTupleScheme getScheme() { + return new sayHello_argsTupleScheme(); + } + } + + private static class sayHello_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetZone()) { + optionals.set(0); + } + if (struct.isSetName()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetZone()) { + oprot.writeString(struct.zone); + } + if (struct.isSetName()) { + oprot.writeString(struct.name); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } + if (incoming.get(1)) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } + } + } + } + + public static class sayHello_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new sayHello_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new sayHello_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_result.class, metaDataMap); + } + + public sayHello_result() {} + + public sayHello_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public sayHello_result(sayHello_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public sayHello_result deepCopy() { + return new sayHello_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public sayHello_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof sayHello_result) return this.equals((sayHello_result) that); + return false; + } + + public boolean equals(sayHello_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(sayHello_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("sayHello_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_resultStandardSchemeFactory implements SchemeFactory { + public sayHello_resultStandardScheme getScheme() { + return new sayHello_resultStandardScheme(); + } + } + + private static class sayHello_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_resultTupleSchemeFactory implements SchemeFactory { + public sayHello_resultTupleScheme getScheme() { + return new sayHello_resultTupleScheme(); + } + } + + private static class sayHello_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withDelay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withDelay_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withDelay_argsTupleSchemeFactory()); + } + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_args.class, metaDataMap); + } + + public withDelay_args() {} + + public withDelay_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public withDelay_args(withDelay_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public withDelay_args deepCopy() { + return new withDelay_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public withDelay_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return Integer.valueOf(getDelay()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withDelay_args) return this.equals((withDelay_args) that); + return false; + } + + public boolean equals(withDelay_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(withDelay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withDelay_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_argsStandardSchemeFactory implements SchemeFactory { + public withDelay_argsStandardScheme getScheme() { + return new withDelay_argsStandardScheme(); + } + } + + private static class withDelay_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_argsTupleSchemeFactory implements SchemeFactory { + public withDelay_argsTupleScheme getScheme() { + return new withDelay_argsTupleScheme(); + } + } + + private static class withDelay_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + } + + public static class withDelay_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withDelay_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withDelay_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_result.class, metaDataMap); + } + + public withDelay_result() {} + + public withDelay_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withDelay_result(withDelay_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withDelay_result deepCopy() { + return new withDelay_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withDelay_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withDelay_result) return this.equals((withDelay_result) that); + return false; + } + + public boolean equals(withDelay_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(withDelay_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withDelay_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_resultStandardSchemeFactory implements SchemeFactory { + public withDelay_resultStandardScheme getScheme() { + return new withDelay_resultStandardScheme(); + } + } + + private static class withDelay_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_resultTupleSchemeFactory implements SchemeFactory { + public withDelay_resultTupleScheme getScheme() { + return new withDelay_resultTupleScheme(); + } + } + + private static class withDelay_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withoutArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withoutArgs_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withoutArgs_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_args.class, metaDataMap); + } + + public withoutArgs_args() {} + + /** Performs a deep copy on other. */ + public withoutArgs_args(withoutArgs_args other) {} + + public withoutArgs_args deepCopy() { + return new withoutArgs_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withoutArgs_args) return this.equals((withoutArgs_args) that); + return false; + } + + public boolean equals(withoutArgs_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(withoutArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withoutArgs_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_argsStandardSchemeFactory implements SchemeFactory { + public withoutArgs_argsStandardScheme getScheme() { + return new withoutArgs_argsStandardScheme(); + } + } + + private static class withoutArgs_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_argsTupleSchemeFactory implements SchemeFactory { + public withoutArgs_argsTupleScheme getScheme() { + return new withoutArgs_argsTupleScheme(); + } + } + + private static class withoutArgs_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class withoutArgs_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withoutArgs_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withoutArgs_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_result.class, metaDataMap); + } + + public withoutArgs_result() {} + + public withoutArgs_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withoutArgs_result(withoutArgs_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withoutArgs_result deepCopy() { + return new withoutArgs_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withoutArgs_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withoutArgs_result) return this.equals((withoutArgs_result) that); + return false; + } + + public boolean equals(withoutArgs_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(withoutArgs_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withoutArgs_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_resultStandardSchemeFactory implements SchemeFactory { + public withoutArgs_resultStandardScheme getScheme() { + return new withoutArgs_resultStandardScheme(); + } + } + + private static class withoutArgs_resultStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_resultTupleSchemeFactory implements SchemeFactory { + public withoutArgs_resultTupleScheme getScheme() { + return new withoutArgs_resultTupleScheme(); + } + } + + private static class withoutArgs_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withError_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withError_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_args.class, metaDataMap); + } + + public withError_args() {} + + /** Performs a deep copy on other. */ + public withError_args(withError_args other) {} + + public withError_args deepCopy() { + return new withError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withError_args) return this.equals((withError_args) that); + return false; + } + + public boolean equals(withError_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(withError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_argsStandardSchemeFactory implements SchemeFactory { + public withError_argsStandardScheme getScheme() { + return new withError_argsStandardScheme(); + } + } + + private static class withError_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_argsTupleSchemeFactory implements SchemeFactory { + public withError_argsTupleScheme getScheme() { + return new withError_argsTupleScheme(); + } + } + + private static class withError_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class withError_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withError_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withError_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_result.class, metaDataMap); + } + + public withError_result() {} + + public withError_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withError_result(withError_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withError_result deepCopy() { + return new withError_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withError_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withError_result) return this.equals((withError_result) that); + return false; + } + + public boolean equals(withError_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(withError_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withError_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_resultStandardSchemeFactory implements SchemeFactory { + public withError_resultStandardScheme getScheme() { + return new withError_resultStandardScheme(); + } + } + + private static class withError_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_resultTupleSchemeFactory implements SchemeFactory { + public withError_resultTupleScheme getScheme() { + return new withError_resultTupleScheme(); + } + } + + private static class withError_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withCollisioin_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_args"); + + private static final org.apache.thrift.protocol.TField INPUT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "input", org.apache.thrift.protocol.TType.STRING, (short) 3333); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withCollisioin_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withCollisioin_argsTupleSchemeFactory()); + } + + public String input; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + INPUT((short) 3333, "input"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 3333: // INPUT + return INPUT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.INPUT, + new org.apache.thrift.meta_data.FieldMetaData( + "input", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_args.class, metaDataMap); + } + + public withCollisioin_args() {} + + public withCollisioin_args(String input) { + this(); + this.input = input; + } + + /** Performs a deep copy on other. */ + public withCollisioin_args(withCollisioin_args other) { + if (other.isSetInput()) { + this.input = other.input; + } + } + + public withCollisioin_args deepCopy() { + return new withCollisioin_args(this); + } + + @Override + public void clear() { + this.input = null; + } + + public String getInput() { + return this.input; + } + + public withCollisioin_args setInput(String input) { + this.input = input; + return this; + } + + public void unsetInput() { + this.input = null; + } + + /** Returns true if field input is set (has been assigned a value) and false otherwise */ + public boolean isSetInput() { + return this.input != null; + } + + public void setInputIsSet(boolean value) { + if (!value) { + this.input = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case INPUT: + if (value == null) { + unsetInput(); + } else { + setInput((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case INPUT: + return getInput(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case INPUT: + return isSetInput(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withCollisioin_args) return this.equals((withCollisioin_args) that); + return false; + } + + public boolean equals(withCollisioin_args that) { + if (that == null) return false; + + boolean this_present_input = true && this.isSetInput(); + boolean that_present_input = true && that.isSetInput(); + if (this_present_input || that_present_input) { + if (!(this_present_input && that_present_input)) return false; + if (!this.input.equals(that.input)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(withCollisioin_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetInput()).compareTo(other.isSetInput()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInput()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.input, other.input); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withCollisioin_args("); + boolean first = true; + + sb.append("input:"); + if (this.input == null) { + sb.append("null"); + } else { + sb.append(this.input); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_argsStandardSchemeFactory implements SchemeFactory { + public withCollisioin_argsStandardScheme getScheme() { + return new withCollisioin_argsStandardScheme(); + } + } + + private static class withCollisioin_argsStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 3333: // INPUT + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.input != null) { + oprot.writeFieldBegin(INPUT_FIELD_DESC); + oprot.writeString(struct.input); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_argsTupleSchemeFactory implements SchemeFactory { + public withCollisioin_argsTupleScheme getScheme() { + return new withCollisioin_argsTupleScheme(); + } + } + + private static class withCollisioin_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetInput()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetInput()) { + oprot.writeString(struct.input); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } + } + } + } + + public static class withCollisioin_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withCollisioin_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withCollisioin_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_result.class, metaDataMap); + } + + public withCollisioin_result() {} + + public withCollisioin_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withCollisioin_result(withCollisioin_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withCollisioin_result deepCopy() { + return new withCollisioin_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withCollisioin_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withCollisioin_result) return this.equals((withCollisioin_result) that); + return false; + } + + public boolean equals(withCollisioin_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(withCollisioin_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withCollisioin_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_resultStandardSchemeFactory implements SchemeFactory { + public withCollisioin_resultStandardScheme getScheme() { + return new withCollisioin_resultStandardScheme(); + } + } + + private static class withCollisioin_resultStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_resultTupleSchemeFactory implements SchemeFactory { + public withCollisioin_resultTupleScheme getScheme() { + return new withCollisioin_resultTupleScheme(); + } + } + + private static class withCollisioin_resultTupleScheme + extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class noReturn_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new noReturn_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new noReturn_argsTupleSchemeFactory()); + } + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_args.class, metaDataMap); + } + + public noReturn_args() {} + + public noReturn_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public noReturn_args(noReturn_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public noReturn_args deepCopy() { + return new noReturn_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public noReturn_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return Integer.valueOf(getDelay()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof noReturn_args) return this.equals((noReturn_args) that); + return false; + } + + public boolean equals(noReturn_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(noReturn_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("noReturn_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_argsStandardSchemeFactory implements SchemeFactory { + public noReturn_argsStandardScheme getScheme() { + return new noReturn_argsStandardScheme(); + } + } + + private static class noReturn_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_argsTupleSchemeFactory implements SchemeFactory { + public noReturn_argsTupleScheme getScheme() { + return new noReturn_argsTupleScheme(); + } + } + + private static class noReturn_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + } + + public static class noReturn_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_result"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new noReturn_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new noReturn_resultTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_result.class, metaDataMap); + } + + public noReturn_result() {} + + /** Performs a deep copy on other. */ + public noReturn_result(noReturn_result other) {} + + public noReturn_result deepCopy() { + return new noReturn_result(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof noReturn_result) return this.equals((noReturn_result) that); + return false; + } + + public boolean equals(noReturn_result that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(noReturn_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("noReturn_result("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_resultStandardSchemeFactory implements SchemeFactory { + public noReturn_resultStandardScheme getScheme() { + return new noReturn_resultStandardScheme(); + } + } + + private static class noReturn_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_resultTupleSchemeFactory implements SchemeFactory { + public noReturn_resultTupleScheme getScheme() { + return new noReturn_resultTupleScheme(); + } + } + + private static class noReturn_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class oneWayHasArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayHasArgs_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new oneWayHasArgs_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new oneWayHasArgs_argsTupleSchemeFactory()); + } + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayHasArgs_args.class, metaDataMap); + } + + public oneWayHasArgs_args() {} + + public oneWayHasArgs_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public oneWayHasArgs_args(oneWayHasArgs_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public oneWayHasArgs_args deepCopy() { + return new oneWayHasArgs_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public oneWayHasArgs_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return Integer.valueOf(getDelay()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWayHasArgs_args) return this.equals((oneWayHasArgs_args) that); + return false; + } + + public boolean equals(oneWayHasArgs_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(oneWayHasArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWayHasArgs_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayHasArgs_argsStandardSchemeFactory implements SchemeFactory { + public oneWayHasArgs_argsStandardScheme getScheme() { + return new oneWayHasArgs_argsStandardScheme(); + } + } + + private static class oneWayHasArgs_argsStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayHasArgs_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayHasArgs_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayHasArgs_argsTupleSchemeFactory implements SchemeFactory { + public oneWayHasArgs_argsTupleScheme getScheme() { + return new oneWayHasArgs_argsTupleScheme(); + } + } + + private static class oneWayHasArgs_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + } + + public static class oneWay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWay_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new oneWay_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new oneWay_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWay_args.class, metaDataMap); + } + + public oneWay_args() {} + + /** Performs a deep copy on other. */ + public oneWay_args(oneWay_args other) {} + + public oneWay_args deepCopy() { + return new oneWay_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWay_args) return this.equals((oneWay_args) that); + return false; + } + + public boolean equals(oneWay_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(oneWay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWay_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWay_argsStandardSchemeFactory implements SchemeFactory { + public oneWay_argsStandardScheme getScheme() { + return new oneWay_argsStandardScheme(); + } + } + + private static class oneWay_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWay_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWay_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWay_argsTupleSchemeFactory implements SchemeFactory { + public oneWay_argsTupleScheme getScheme() { + return new oneWay_argsTupleScheme(); + } + } + + private static class oneWay_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class oneWayWithError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayWithError_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new oneWayWithError_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new oneWayWithError_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayWithError_args.class, metaDataMap); + } + + public oneWayWithError_args() {} + + /** Performs a deep copy on other. */ + public oneWayWithError_args(oneWayWithError_args other) {} + + public oneWayWithError_args deepCopy() { + return new oneWayWithError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWayWithError_args) return this.equals((oneWayWithError_args) that); + return false; + } + + public boolean equals(oneWayWithError_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(oneWayWithError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWayWithError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayWithError_argsStandardSchemeFactory implements SchemeFactory { + public oneWayWithError_argsStandardScheme getScheme() { + return new oneWayWithError_argsStandardScheme(); + } + } + + private static class oneWayWithError_argsStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayWithError_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayWithError_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayWithError_argsTupleSchemeFactory implements SchemeFactory { + public oneWayWithError_argsTupleScheme getScheme() { + return new oneWayWithError_argsTupleScheme(); + } + } + + private static class oneWayWithError_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class data_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_args"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new data_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new data_argsTupleSchemeFactory()); + } + + public User user; // required + public Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(data_args.class, metaDataMap); + } + + public data_args() {} + + public data_args(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public data_args(data_args other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public data_args deepCopy() { + return new data_args(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + public User getUser() { + return this.user; + } + + public data_args setUser(User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + public Account getAccount() { + return this.account; + } + + public data_args setAccount(Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof data_args) return this.equals((data_args) that); + return false; + } + + public boolean equals(data_args that) { + if (that == null) return false; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(data_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetUser()).compareTo(other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAccount()).compareTo(other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("data_args("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_argsStandardSchemeFactory implements SchemeFactory { + public data_argsStandardScheme getScheme() { + return new data_argsStandardScheme(); + } + } + + private static class data_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_argsTupleSchemeFactory implements SchemeFactory { + public data_argsTupleScheme getScheme() { + return new data_argsTupleScheme(); + } + } + + private static class data_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetUser()) { + optionals.set(0); + } + if (struct.isSetAccount()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetUser()) { + struct.user.write(oprot); + } + if (struct.isSetAccount()) { + struct.account.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } + if (incoming.get(1)) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + } + } + + public static class data_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRUCT, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new data_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new data_resultTupleSchemeFactory()); + } + + public UserAccount success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, UserAccount.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + data_result.class, metaDataMap); + } + + public data_result() {} + + public data_result(UserAccount success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public data_result(data_result other) { + if (other.isSetSuccess()) { + this.success = new UserAccount(other.success); + } + } + + public data_result deepCopy() { + return new data_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public UserAccount getSuccess() { + return this.success; + } + + public data_result setSuccess(UserAccount success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((UserAccount) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof data_result) return this.equals((data_result) that); + return false; + } + + public boolean equals(data_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(data_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("data_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_resultStandardSchemeFactory implements SchemeFactory { + public data_resultStandardScheme getScheme() { + return new data_resultStandardScheme(); + } + } + + private static class data_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_resultTupleSchemeFactory implements SchemeFactory { + public data_resultTupleScheme getScheme() { + return new data_resultTupleScheme(); + } + } + + private static class data_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/thrift/User.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/thrift/User.java new file mode 100644 index 000000000000..ea27a86d548f --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/thrift/User.java @@ -0,0 +1,579 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.thrift; + +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "all"}) +public class User + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("User"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "userId", org.apache.thrift.protocol.TType.STRING, (short) 2); + private static final org.apache.thrift.protocol.TField AGE_FIELD_DESC = + new org.apache.thrift.protocol.TField("age", org.apache.thrift.protocol.TType.I32, (short) 3); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new UserStandardSchemeFactory()); + schemes.put(TupleScheme.class, new UserTupleSchemeFactory()); + } + + public String name; // required + public String userId; // required + public int age; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + NAME((short) 1, "name"), + USER_ID((short) 2, "userId"), + AGE((short) 3, "age"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // NAME + return NAME; + case 2: // USER_ID + return USER_ID; + case 3: // AGE + return AGE; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __AGE_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.USER_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "userId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.AGE, + new org.apache.thrift.meta_data.FieldMetaData( + "age", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(User.class, metaDataMap); + } + + public User() {} + + public User(String name, String userId, int age) { + this(); + this.name = name; + this.userId = userId; + this.age = age; + setAgeIsSet(true); + } + + /** Performs a deep copy on other. */ + public User(User other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetName()) { + this.name = other.name; + } + if (other.isSetUserId()) { + this.userId = other.userId; + } + this.age = other.age; + } + + public User deepCopy() { + return new User(this); + } + + @Override + public void clear() { + this.name = null; + this.userId = null; + setAgeIsSet(false); + this.age = 0; + } + + public String getName() { + return this.name; + } + + public User setName(String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public String getUserId() { + return this.userId; + } + + public User setUserId(String userId) { + this.userId = userId; + return this; + } + + public void unsetUserId() { + this.userId = null; + } + + /** Returns true if field userId is set (has been assigned a value) and false otherwise */ + public boolean isSetUserId() { + return this.userId != null; + } + + public void setUserIdIsSet(boolean value) { + if (!value) { + this.userId = null; + } + } + + public int getAge() { + return this.age; + } + + public User setAge(int age) { + this.age = age; + setAgeIsSet(true); + return this; + } + + public void unsetAge() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __AGE_ISSET_ID); + } + + /** Returns true if field age is set (has been assigned a value) and false otherwise */ + public boolean isSetAge() { + return EncodingUtils.testBit(__isset_bitfield, __AGE_ISSET_ID); + } + + public void setAgeIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __AGE_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case NAME: + if (value == null) { + unsetName(); + } else { + setName((String) value); + } + break; + + case USER_ID: + if (value == null) { + unsetUserId(); + } else { + setUserId((String) value); + } + break; + + case AGE: + if (value == null) { + unsetAge(); + } else { + setAge((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case NAME: + return getName(); + + case USER_ID: + return getUserId(); + + case AGE: + return Integer.valueOf(getAge()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case NAME: + return isSetName(); + case USER_ID: + return isSetUserId(); + case AGE: + return isSetAge(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof User) return this.equals((User) that); + return false; + } + + public boolean equals(User that) { + if (that == null) return false; + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + boolean this_present_userId = true && this.isSetUserId(); + boolean that_present_userId = true && that.isSetUserId(); + if (this_present_userId || that_present_userId) { + if (!(this_present_userId && that_present_userId)) return false; + if (!this.userId.equals(that.userId)) return false; + } + + boolean this_present_age = true; + boolean that_present_age = true; + if (this_present_age || that_present_age) { + if (!(this_present_age && that_present_age)) return false; + if (this.age != that.age) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(User other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetUserId()).compareTo(other.isSetUserId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAge()).compareTo(other.isSetAge()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAge()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.age, other.age); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("User("); + boolean first = true; + + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + if (!first) sb.append(", "); + sb.append("userId:"); + if (this.userId == null) { + sb.append("null"); + } else { + sb.append(this.userId); + } + first = false; + if (!first) sb.append(", "); + sb.append("age:"); + sb.append(this.age); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (name == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'name' was not present! Struct: " + toString()); + } + if (userId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'userId' was not present! Struct: " + toString()); + } + // alas, we cannot check 'age' because it's a primitive and you chose the non-beans generator. + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserStandardSchemeFactory implements SchemeFactory { + public UserStandardScheme getScheme() { + return new UserStandardScheme(); + } + } + + private static class UserStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // AGE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + if (!struct.isSetAge()) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'age' was not found in serialized data! Struct: " + toString()); + } + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, User struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + if (struct.userId != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userId); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(AGE_FIELD_DESC); + oprot.writeI32(struct.age); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserTupleSchemeFactory implements SchemeFactory { + public UserTupleScheme getScheme() { + return new UserTupleScheme(); + } + } + + private static class UserTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeString(struct.name); + oprot.writeString(struct.userId); + oprot.writeI32(struct.age); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.name = iprot.readString(); + struct.setNameIsSet(true); + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/thrift/UserAccount.java b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/thrift/UserAccount.java new file mode 100644 index 000000000000..9cfb452f0ab0 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_9_1/thrift/UserAccount.java @@ -0,0 +1,488 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.instrumentation.thrift.v0_9_1.thrift; + +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "all"}) +public class UserAccount + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("UserAccount"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new UserAccountStandardSchemeFactory()); + schemes.put(TupleScheme.class, new UserAccountTupleSchemeFactory()); + } + + public User user; // required + public Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserAccount.class, metaDataMap); + } + + public UserAccount() {} + + public UserAccount(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public UserAccount(UserAccount other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public UserAccount deepCopy() { + return new UserAccount(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + public User getUser() { + return this.user; + } + + public UserAccount setUser(User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + public Account getAccount() { + return this.account; + } + + public UserAccount setAccount(Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof UserAccount) return this.equals((UserAccount) that); + return false; + } + + public boolean equals(UserAccount that) { + if (that == null) return false; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(UserAccount other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetUser()).compareTo(other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAccount()).compareTo(other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("UserAccount("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (user == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'user' was not present! Struct: " + toString()); + } + if (account == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'account' was not present! Struct: " + toString()); + } + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserAccountStandardSchemeFactory implements SchemeFactory { + public UserAccountStandardScheme getScheme() { + return new UserAccountStandardScheme(); + } + } + + private static class UserAccountStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, UserAccount struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserAccountTupleSchemeFactory implements SchemeFactory { + public UserAccountTupleScheme getScheme() { + return new UserAccountTupleScheme(); + } + } + + private static class UserAccountTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + struct.user.write(oprot); + struct.account.write(oprot); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.2-testing/build.gradle.kts b/instrumentation/thrift/thrift-0.9.2-testing/build.gradle.kts new file mode 100644 index 000000000000..05469e2d4146 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.2-testing/build.gradle.kts @@ -0,0 +1,12 @@ +plugins { + id("otel.javaagent-testing") +} + +dependencies { + testImplementation("org.apache.thrift:libthrift:0.9.2") + testImplementation("javax.annotation:javax.annotation-api:1.3.2") + + implementation(project(":instrumentation:thrift:thrift-0.9.1:javaagent")) { + exclude("org.apache.thrift", "libthrift") + } +} diff --git a/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/NoReturnTest.java b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/NoReturnTest.java new file mode 100644 index 000000000000..6ac4d7c225a6 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/NoReturnTest.java @@ -0,0 +1,1097 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_2; + +import io.opentelemetry.instrumentation.thrift.v0_9_2.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFastFramedTransport; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class NoReturnTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerNoReturn() throws TException { + this.startSyncSimpleServer(this.port); + this.syncClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncClientSyncSimpleServerNoReturnMuti() throws TException { + this.startSyncSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientNoReturn(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("noReturn", 5); + } + + @Test + public void syncClientSyncSimpleServerNoReturnParallel() throws TException, InterruptedException { + this.startSyncSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientNoReturn(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerNoReturnParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("noReturn", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerNoReturn() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncClientSyncThreadPoolServerNoReturnMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientNoReturn(port); + } + this.waitAndAssertTracesClientSyncServerSync("noReturn", 5); + } + + @Test + public void syncClientSyncThreadPoolServerNoReturnParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientNoReturn(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerNoReturnParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("noReturn", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerNoReturn() throws TException { + this.startMultiSimpleServer(this.port); + this.syncClientMultiNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", "syncHelloWorld:noReturn", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerNoReturnMuti() throws TException { + this.startMultiSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiNoReturn(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("noReturn", "syncHelloWorld:noReturn", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerNoReturnParallel() + throws TException, InterruptedException { + this.startMultiSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiNoReturn(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerNoReturnParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "noReturn", "syncHelloWorld:noReturn", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerNoReturnError() { + Exception error = null; + try { + this.startSyncThreadedSelectorServer(this.port); + this.syncClientNoReturn(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("noReturn", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerNoReturnError() { + Exception error = null; + try { + this.startAsyncThreadedSelectorServer(this.port); + this.syncClientNoReturn(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("noReturn", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerNoReturn() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + this.syncFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFastFramedClientAsyncThreadedSelectorServerNoReturn() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + this.syncFastFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorFastServerNoReturn() throws TException { + this.startAsyncThreadedSelectorFastServer(this.port); + this.syncFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFastFramedClientAsyncThreadedSelectorFastServerNoReturn() throws TException { + this.startAsyncThreadedSelectorFastServer(this.port); + this.syncFastFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerNoReturnMuti() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientNoReturn(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerNoReturnParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientNoReturn(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerNoReturn() throws TException { + this.startMultiThreadedSelectorServer(this.port); + this.syncFramedClientMultiNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", "syncHelloWorld:noReturn", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerNoReturnMuti() throws TException { + this.startMultiThreadedSelectorServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiNoReturn(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("noReturn", "syncHelloWorld:noReturn", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerNoReturnParallel() + throws TException, InterruptedException { + this.startMultiThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiNoReturn(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "noReturn", "syncHelloWorld:noReturn", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerNoReturn() throws TException { + this.startSyncThreadedSelectorServer(this.port); + this.syncFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFastFramedClientSyncThreadedSelectorServerNoReturn() throws TException { + this.startSyncThreadedSelectorServer(this.port); + this.syncFastFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorFastServerNoReturn() throws TException { + this.startSyncThreadedSelectorFastServer(this.port); + this.syncFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFastFramedClientSyncThreadedSelectorFastServerNoReturn() throws TException { + this.startSyncThreadedSelectorFastServer(this.port); + this.syncFastFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerNoReturnMuti() throws TException { + this.startSyncThreadedSelectorServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncFramedClientNoReturn(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("noReturn", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerNoReturnParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientNoReturn(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("noReturn", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerNoReturn() throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + this.nonBlockClientNoReturn(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerNoReturnMuti() + throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + for (int i = 0; i < 5; ++i) { + this.nonBlockClientNoReturn(this.port); + } + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerNoReturnParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientNoReturn(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerNoReturn() throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + this.nonBlockClientNoReturn(this.port); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerNoReturnMuti() + throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + for (int i = 0; i < 5; ++i) { + this.nonBlockClientNoReturn(this.port); + } + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerNoReturnParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientNoReturn(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerNoReturn() throws TException { + this.startSyncNonblockingServer(this.port); + this.syncFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFastFramedClientSyncNonblockingServerNoReturn() throws TException { + this.startSyncNonblockingServer(this.port); + this.syncFastFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFramedClientSyncNonblockingFastServerNoReturn() throws TException { + this.startSyncNonblockingFastServer(this.port); + this.syncFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFastFramedClientSyncNonblockingFastServerNoReturn() throws TException { + this.startSyncNonblockingFastServer(this.port); + this.syncFastFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerNoReturnMuti() throws TException { + this.startSyncNonblockingServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncFramedClientNoReturn(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("noReturn", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerNoReturnParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientNoReturn(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("noReturn", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerNoReturn() throws TException { + this.startSyncHsHaServer(this.port); + this.syncFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFastFramedClientSyncHsHaServerNoReturn() throws TException { + this.startSyncHsHaServer(this.port); + this.syncFastFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFramedClientSyncHsHaFastServerNoReturn() throws TException { + this.startSyncHsHaFastServer(this.port); + this.syncFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFastFramedClientSyncHsHaFastServerNoReturn() throws TException { + this.startSyncHsHaFastServer(this.port); + this.syncFastFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerNoReturnMuti() throws TException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientNoReturn(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("noReturn", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerNoReturnParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientNoReturn(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("noReturn", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerNoReturn() throws TException { + this.startAsyncNonblockingServer(this.port); + this.syncFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFastFramedClientAsyncNonblockingServerNoReturn() throws TException { + this.startAsyncNonblockingServer(this.port); + this.syncFastFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerNoReturnMuti() throws TException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientNoReturn(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerNoReturnParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientNoReturn(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerNoReturn() throws TException { + this.startAsyncHsHaServer(this.port); + this.syncFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFastFramedClientAsyncHsHaServerNoReturn() throws TException { + this.startAsyncHsHaServer(this.port); + this.syncFastFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFramedClientAsyncHsHaFastServerNoReturn() throws TException { + this.startAsyncHsHaFastServer(this.port); + this.syncFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFastFramedClientAsyncHsHaFastServerNoReturn() throws TException { + this.startAsyncHsHaFastServer(this.port); + this.syncFastFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerNoReturnMuti() throws TException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientNoReturn(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerNoReturnParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientNoReturn(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerNoReturn() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + this.nonBlockClientNoReturn(this.port); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerNoReturnMuti() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientNoReturn(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerNoReturnParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientNoReturn(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerNoReturn() throws TException, IOException { + this.startSyncHsHaServer(this.port); + this.nonBlockClientNoReturn(this.port); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerNoReturnMuti() throws TException, IOException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientNoReturn(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerNoReturnParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientNoReturn(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerNoReturnError() { + Exception error = null; + try { + this.startAsyncNonblockingServer(this.port); + this.syncClientNoReturn(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("noReturn", 1); + } + + @Test + public void syncClientSyncNonblockingServerNoReturnError() { + Exception error = null; + try { + this.startSyncNonblockingServer(this.port); + this.syncClientNoReturn(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("noReturn", 1); + } + + @Test + public void syncClientAsyncHsHaServerNoReturnError() { + Exception error = null; + try { + this.startAsyncHsHaServer(this.port); + this.syncClientNoReturn(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("noReturn", 1); + } + + @Test + public void syncClientSyncHsHaServerNoReturnError() { + Exception error = null; + try { + this.startSyncHsHaServer(this.port); + this.syncClientNoReturn(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("noReturn", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerNoReturn() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + this.nonBlockClientNoReturn(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerNoReturnMuti() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientNoReturn(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerNoReturnParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientNoReturn(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerNoReturn() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + this.nonBlockClientNoReturn(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerNoReturnMuti() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientNoReturn(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerNoReturnParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientNoReturn(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", threadCount); + } + + public void syncClientNoReturn(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.noReturn(1)); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncClientMultiNoReturn(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + this.testing().runWithSpan("parent", () -> client.noReturn(1)); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientNoReturn(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.noReturn_call s) {} + + @Override + public void onError(Exception e) { + Assertions.assertThat(e.getCause().getMessage()) + .isEqualTo("Read call frame size failed"); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.noReturn(1, callback)); + } + + public void syncFramedClientNoReturn(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.noReturn(1)); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFastFramedClientNoReturn(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFastFramedTransport framedTransport = new TFastFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.noReturn(1)); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFramedClientMultiNoReturn(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + this.testing().runWithSpan("parent", () -> client.noReturn(1)); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientNoReturn(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.noReturn(1)); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/OneWayErrorTest.java b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/OneWayErrorTest.java new file mode 100644 index 000000000000..1d3d0b73e10c --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/OneWayErrorTest.java @@ -0,0 +1,997 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_2; + +import io.opentelemetry.instrumentation.thrift.v0_9_2.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class OneWayErrorTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerOneWayWithError() throws TException { + this.startSyncSimpleServer(this.port); + this.syncClientOneWayWithError(this.port); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void syncClientSyncSimpleServerOneWayWithErrorMuti() throws TException { + this.startSyncSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientOneWayWithError(this.port); + } + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void syncClientSyncSimpleServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startSyncSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientOneWayWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerOneWayWithError() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientOneWayWithError(port); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void syncClientSyncThreadPoolServerOneWayWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientOneWayWithError(port); + } + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void syncClientSyncThreadPoolServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientOneWayWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerOneWayWithError() throws TException { + this.startMultiSimpleServer(this.port); + this.syncClientMultiOneWayWithError(this.port); + this.waitAndAssertTracesClientSyncServerSyncOnewayError( + "oneWayWithError", "syncHelloWorld:oneWayWithError", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerOneWayWithErrorMuti() throws TException { + this.startMultiSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiOneWayWithError(this.port); + } + this.waitAndAssertTracesClientSyncServerSyncOnewayError( + "oneWayWithError", "syncHelloWorld:oneWayWithError", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startMultiSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiOneWayWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOnewayError( + "oneWayWithError", "syncHelloWorld:oneWayWithError", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerOneWayWithErrorError() { + Exception error = null; + try { + this.startSyncThreadedSelectorServer(this.port); + this.syncClientOneWayWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWayWithError", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerOneWayWithErrorError() { + Exception error = null; + try { + this.startAsyncThreadedSelectorServer(this.port); + this.syncClientOneWayWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWayWithError", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerOneWayWithError() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + this.syncFramedClientOneWayWithError(this.port); + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerOneWayWithErrorMuti() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWayWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerOneWayWithError() throws TException { + this.startMultiThreadedSelectorServer(this.port); + this.syncFramedClientMultiOneWayWithError(this.port); + this.waitAndAssertTracesClientSyncServerSyncOnewayError( + "oneWayWithError", "syncHelloWorld:oneWayWithError", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerOneWayWithErrorMuti() + throws TException { + this.startMultiThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerSyncOnewayError( + "oneWayWithError", "syncHelloWorld:oneWayWithError", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startMultiThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiOneWayWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOnewayError( + "oneWayWithError", "syncHelloWorld:oneWayWithError", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerOneWayWithError() throws TException { + this.startSyncThreadedSelectorServer(this.port); + this.syncFramedClientOneWayWithError(this.port); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerOneWayWithErrorMuti() throws TException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWayWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerOneWayWithError() + throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + this.nonBlockClientOneWayWithError(this.port); + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerOneWayWithErrorMuti() + throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWayWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerOneWayWithError() + throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + this.nonBlockClientOneWayWithError(this.port); + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerOneWayWithErrorMuti() + throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWayWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWayWithError() throws TException { + this.startSyncNonblockingServer(this.port); + this.syncFramedClientOneWayWithError(this.port); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWayWithErrorMuti() throws TException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWayWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWayWithError() throws TException { + this.startSyncHsHaServer(this.port); + this.syncFramedClientOneWayWithError(this.port); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWayWithErrorMuti() throws TException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWayWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerOneWayWithError() throws TException { + this.startAsyncNonblockingServer(this.port); + this.syncFramedClientOneWayWithError(this.port); + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerOneWayWithErrorMuti() throws TException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWayWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerOneWayWithError() throws TException { + this.startAsyncHsHaServer(this.port); + this.syncFramedClientOneWayWithError(this.port); + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerOneWayWithErrorMuti() throws TException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWayWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWayWithError() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + this.nonBlockClientOneWayWithError(this.port); + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWayWithErrorMuti() + throws TException, IOException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWayWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWayWithError() throws TException, IOException { + this.startSyncHsHaServer(this.port); + this.nonBlockClientOneWayWithError(this.port); + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWayWithErrorMuti() throws TException, IOException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWayWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerOneWayWithErrorError() { + Exception error = null; + try { + this.startAsyncNonblockingServer(this.port); + this.syncClientOneWayWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWayWithError", 1); + } + + @Test + public void syncClientSyncNonblockingServerOneWayWithErrorError() { + Exception error = null; + try { + this.startSyncNonblockingServer(this.port); + this.syncClientOneWayWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWayWithError", 1); + } + + @Test + public void syncClientAsyncHsHaServerOneWayWithErrorError() { + Exception error = null; + try { + this.startAsyncHsHaServer(this.port); + this.syncClientOneWayWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWayWithError", 1); + } + + @Test + public void syncClientSyncHsHaServerOneWayWithErrorError() { + Exception error = null; + try { + this.startSyncHsHaServer(this.port); + this.syncClientOneWayWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWayWithError", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerOneWayWithError() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + this.nonBlockClientOneWayWithError(this.port); + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerOneWayWithErrorMuti() + throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWayWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerOneWayWithError() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + this.nonBlockClientOneWayWithError(this.port); + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerOneWayWithErrorMuti() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWayWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", threadCount); + } + + public void syncClientOneWayWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.oneWayWithError()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncClientMultiOneWayWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + this.testing().runWithSpan("parent", () -> client.oneWayWithError()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientOneWayWithError(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.oneWayWithError_call no) {} + + @Override + public void onError(Exception e) { + Assertions.assertThat(e.getCause().getMessage()) + .isEqualTo("Read call frame size failed"); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.oneWayWithError(callback)); + } + + public void syncFramedClientOneWayWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.oneWayWithError()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFramedClientMultiOneWayWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + this.testing().runWithSpan("parent", () -> client.oneWayWithError()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientOneWayWithError(int port) throws IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.oneWayWithError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/OneWayTest.java b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/OneWayTest.java new file mode 100644 index 000000000000..29c1aaba5c2c --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/OneWayTest.java @@ -0,0 +1,978 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_2; + +import io.opentelemetry.instrumentation.thrift.v0_9_2.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class OneWayTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerOneWay() throws TException { + this.startSyncSimpleServer(this.port); + this.syncClientOneWay(this.port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", 1); + } + + @Test + public void syncClientSyncSimpleServerOneWayMuti() throws TException { + this.startSyncSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientOneWay(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("oneWay", 5); + } + + @Test + public void syncClientSyncSimpleServerOneWayParallel() throws TException, InterruptedException { + this.startSyncSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientOneWay(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerOneWay() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientOneWay(port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", 1); + } + + @Test + public void syncClientSyncThreadPoolServerOneWayMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientOneWay(port); + } + this.waitAndAssertTracesClientSyncServerSync("oneWay", 5); + } + + @Test + public void syncClientSyncThreadPoolServerOneWayParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientOneWay(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerOneWay() throws TException { + this.startMultiSimpleServer(this.port); + this.syncClientMultiOneWay(this.port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", "syncHelloWorld:oneWay", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerOneWayMuti() throws TException { + this.startMultiSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiOneWay(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("oneWay", "syncHelloWorld:oneWay", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerOneWayParallel() + throws TException, InterruptedException { + this.startMultiSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiOneWay(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", "syncHelloWorld:oneWay", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerOneWayError() { + Exception error = null; + try { + this.startSyncThreadedSelectorServer(this.port); + this.syncClientOneWay(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWay", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerOneWayError() { + Exception error = null; + try { + this.startAsyncThreadedSelectorServer(this.port); + this.syncClientOneWay(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWay", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerOneWay() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + this.syncFramedClientOneWay(this.port); + this.waitAndAssertTracesClientSyncServerAsync("oneWay", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerOneWayMuti() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWay(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("oneWay", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerOneWayParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWay(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("oneWay", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerOneWay() throws TException { + this.startMultiThreadedSelectorServer(this.port); + this.syncFramedClientMultiOneWay(this.port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", "syncHelloWorld:oneWay", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerOneWayMuti() throws TException { + this.startMultiThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiOneWay(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("oneWay", "syncHelloWorld:oneWay", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerOneWayParallel() + throws TException, InterruptedException { + this.startMultiThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiOneWay(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", "syncHelloWorld:oneWay", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerOneWay() throws TException { + this.startSyncThreadedSelectorServer(this.port); + this.syncFramedClientOneWay(this.port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerOneWayMuti() throws TException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWay(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("oneWay", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerOneWayParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWay(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerOneWay() throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + this.nonBlockClientOneWay(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerOneWayMuti() throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWay(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerOneWayParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWay(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerOneWay() throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + this.nonBlockClientOneWay(this.port); + this.waitAndAssertTracesClientAsyncServerSync("oneWay", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerOneWayMuti() throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWay(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("oneWay", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerOneWayParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWay(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("oneWay", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWay() throws TException { + this.startSyncNonblockingServer(this.port); + this.syncFramedClientOneWay(this.port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWayMuti() throws TException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWay(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("oneWay", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWayParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWay(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWay() throws TException { + this.startSyncHsHaServer(this.port); + this.syncFramedClientOneWay(this.port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWayMuti() throws TException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWay(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("oneWay", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWayParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWay(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerOneWay() throws TException { + this.startAsyncNonblockingServer(this.port); + this.syncFramedClientOneWay(this.port); + this.waitAndAssertTracesClientSyncServerAsync("oneWay", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerOneWayMuti() throws TException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWay(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("oneWay", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerOneWayParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWay(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("oneWay", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerOneWay() throws TException { + this.startAsyncHsHaServer(this.port); + this.syncFramedClientOneWay(this.port); + this.waitAndAssertTracesClientSyncServerAsync("oneWay", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerOneWayMuti() throws TException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWay(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("oneWay", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerOneWayParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWay(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("oneWay", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWay() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + this.nonBlockClientOneWay(this.port); + this.waitAndAssertTracesClientAsyncServerSync("oneWay", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWayMuti() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWay(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("oneWay", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWayParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWay(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("oneWay", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWay() throws TException, IOException { + this.startSyncHsHaServer(this.port); + this.nonBlockClientOneWay(this.port); + this.waitAndAssertTracesClientAsyncServerSync("oneWay", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWayMuti() throws TException, IOException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWay(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("oneWay", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWayParallel() throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWay(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("oneWay", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerOneWayError() { + Exception error = null; + try { + this.startAsyncNonblockingServer(this.port); + this.syncClientOneWay(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWay", 1); + } + + @Test + public void syncClientSyncNonblockingServerOneWayError() { + Exception error = null; + try { + this.startSyncNonblockingServer(this.port); + this.syncClientOneWay(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWay", 1); + } + + @Test + public void syncClientAsyncHsHaServerOneWayError() { + Exception error = null; + try { + this.startAsyncHsHaServer(this.port); + this.syncClientOneWay(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWay", 1); + } + + @Test + public void syncClientSyncHsHaServerOneWayError() { + Exception error = null; + try { + this.startSyncHsHaServer(this.port); + this.syncClientOneWay(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWay", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerOneWay() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + this.nonBlockClientOneWay(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerOneWayMuti() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWay(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerOneWayParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWay(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerOneWay() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + this.nonBlockClientOneWay(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerOneWayMuti() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWay(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerOneWayParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWay(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", threadCount); + } + + public void syncClientOneWay(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.oneWay()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncClientMultiOneWay(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + this.testing().runWithSpan("parent", () -> client.oneWay()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientOneWay(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.oneWay_call no) {} + + @Override + public void onError(Exception e) { + Assertions.assertThat(e.getCause().getMessage()) + .isEqualTo("Read call frame size failed"); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.oneWay(callback)); + } + + public void syncFramedClientOneWay(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.oneWay()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFramedClientMultiOneWay(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + this.testing().runWithSpan("parent", () -> client.oneWay()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientOneWay(int port) throws IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.oneWay()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/SayHelloTest.java b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/SayHelloTest.java new file mode 100644 index 000000000000..e74280015d98 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/SayHelloTest.java @@ -0,0 +1,1110 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_2; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_9_2.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFastFramedTransport; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class SayHelloTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerSayHello() throws TException { + this.startSyncSimpleServer(this.port); + this.syncClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncClientSyncSimpleServerSayHelloMuti() throws TException { + this.startSyncSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientSayHello(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("sayHello", 5); + } + + @Test + public void syncClientSyncSimpleServerSayHelloParallel() throws TException, InterruptedException { + this.startSyncSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientSayHello(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("sayHello", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerSayHello() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncClientSyncThreadPoolServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientSayHello(port); + } + this.waitAndAssertTracesClientSyncServerSync("sayHello", 5); + } + + @Test + public void syncClientSyncThreadPoolServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientSayHello(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("sayHello", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerSayHello() throws TException { + this.startMultiSimpleServer(this.port); + this.syncClientMultiSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", "syncHelloWorld:sayHello", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerSayHelloMuti() throws TException { + this.startMultiSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiSayHello(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("sayHello", "syncHelloWorld:sayHello", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerSayHelloParallel() + throws TException, InterruptedException { + this.startMultiSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiSayHello(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "sayHello", "syncHelloWorld:sayHello", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerSayHelloError() { + Exception error = null; + try { + this.startSyncThreadedSelectorServer(this.port); + this.syncClientSayHello(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("sayHello", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerSayHelloError() { + Exception error = null; + try { + this.startAsyncThreadedSelectorServer(this.port); + this.syncClientSayHello(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("sayHello", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerSayHello() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + this.syncFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFastFramedClientAsyncThreadedSelectorServerSayHello() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + this.syncFastFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorFastServerSayHello() throws TException { + this.startAsyncThreadedSelectorFastServer(this.port); + this.syncFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFastFramedClientAsyncThreadedSelectorFastServerSayHello() throws TException { + this.startAsyncThreadedSelectorFastServer(this.port); + this.syncFastFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerSayHelloMuti() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientSayHello(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientSayHello(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerSayHello() throws TException { + this.startMultiThreadedSelectorServer(this.port); + this.syncFramedClientMultiSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", "syncHelloWorld:sayHello", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerSayHelloMuti() throws TException { + this.startMultiThreadedSelectorServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiSayHello(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("sayHello", "syncHelloWorld:sayHello", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + this.startMultiThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiSayHello(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "sayHello", "syncHelloWorld:sayHello", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerSayHello() throws TException { + this.startSyncThreadedSelectorServer(this.port); + this.syncFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFastFramedClientSyncThreadedSelectorServerSayHello() throws TException { + this.startSyncThreadedSelectorServer(this.port); + this.syncFastFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorFastServerSayHello() throws TException { + this.startSyncThreadedSelectorFastServer(this.port); + this.syncFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFastFramedClientSyncThreadedSelectorFastServerSayHello() throws TException { + this.startSyncThreadedSelectorFastServer(this.port); + this.syncFastFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerSayHelloMuti() throws TException { + this.startSyncThreadedSelectorServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncFramedClientSayHello(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("sayHello", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientSayHello(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("sayHello", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerSayHello() throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + this.nonBlockClientSayHello(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerSayHelloMuti() + throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + for (int i = 0; i < 5; ++i) { + this.nonBlockClientSayHello(this.port); + } + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientSayHello(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerSayHello() throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + this.nonBlockClientSayHello(this.port); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerSayHelloMuti() + throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + for (int i = 0; i < 5; ++i) { + this.nonBlockClientSayHello(this.port); + } + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientSayHello(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHello() throws TException { + this.startSyncNonblockingServer(this.port); + this.syncFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFastFramedClientSyncNonblockingServerSayHello() throws TException { + this.startSyncNonblockingServer(this.port); + this.syncFastFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFramedClientSyncNonblockingFastServerSayHello() throws TException { + this.startSyncNonblockingFastServer(this.port); + this.syncFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFastFramedClientSyncNonblockingFastServerSayHello() throws TException { + this.startSyncNonblockingFastServer(this.port); + this.syncFastFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHelloMuti() throws TException { + this.startSyncNonblockingServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncFramedClientSayHello(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("sayHello", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientSayHello(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("sayHello", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHello() throws TException { + this.startSyncHsHaServer(this.port); + this.syncFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFastFramedClientSyncHsHaServerSayHello() throws TException { + this.startSyncHsHaServer(this.port); + this.syncFastFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFramedClientSyncHsHaFastServerSayHello() throws TException { + this.startSyncHsHaFastServer(this.port); + this.syncFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFastFramedClientSyncHsHaFastServerSayHello() throws TException { + this.startSyncHsHaFastServer(this.port); + this.syncFastFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHelloMuti() throws TException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientSayHello(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("sayHello", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientSayHello(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("sayHello", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerSayHello() throws TException { + this.startAsyncNonblockingServer(this.port); + this.syncFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFastFramedClientAsyncNonblockingServerSayHello() throws TException { + this.startAsyncNonblockingServer(this.port); + this.syncFastFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerSayHelloMuti() throws TException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientSayHello(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientSayHello(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerSayHello() throws TException { + this.startAsyncHsHaServer(this.port); + this.syncFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFastFramedClientAsyncHsHaServerSayHello() throws TException { + this.startAsyncHsHaServer(this.port); + this.syncFastFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFramedClientAsyncHsHaFastServerSayHello() throws TException { + this.startAsyncHsHaFastServer(this.port); + this.syncFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFastFramedClientAsyncHsHaFastServerSayHello() throws TException { + this.startAsyncHsHaFastServer(this.port); + this.syncFastFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerSayHelloMuti() throws TException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientSayHello(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientSayHello(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHello() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + this.nonBlockClientSayHello(this.port); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHelloMuti() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientSayHello(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientSayHello(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHello() throws TException, IOException { + this.startSyncHsHaServer(this.port); + this.nonBlockClientSayHello(this.port); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHelloMuti() throws TException, IOException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientSayHello(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientSayHello(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerSayHelloError() { + Exception error = null; + try { + this.startAsyncNonblockingServer(this.port); + this.syncClientSayHello(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("sayHello", 1); + } + + @Test + public void syncClientSyncNonblockingServerSayHelloError() { + Exception error = null; + try { + this.startSyncNonblockingServer(this.port); + this.syncClientSayHello(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("sayHello", 1); + } + + @Test + public void syncClientAsyncHsHaServerSayHelloError() { + Exception error = null; + try { + this.startAsyncHsHaServer(this.port); + this.syncClientSayHello(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("sayHello", 1); + } + + @Test + public void syncClientSyncHsHaServerSayHelloError() { + Exception error = null; + try { + this.startSyncHsHaServer(this.port); + this.syncClientSayHello(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("sayHello", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerSayHello() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + this.nonBlockClientSayHello(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerSayHelloMuti() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientSayHello(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientSayHello(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerSayHello() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + this.nonBlockClientSayHello(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerSayHelloMuti() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientSayHello(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientSayHello(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", threadCount); + } + + public void syncClientSayHello(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.sayHello("US", "Bob")); + Assertions.assertThat(response).isEqualTo("Hello USs' Bob"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncClientMultiSayHello(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + String response = this.testing().runWithSpan("parent", () -> client.sayHello("US", "Bob")); + Assertions.assertThat(response).isEqualTo("Hello USs' Bob"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientSayHello(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.sayHello_call s) { + try { + String result = s.getResult(); + Assertions.assertThat(result).isEqualTo("Hello USs' Bob"); + } catch (TException e) { + throw new VerifyException(e); + } + } + + @Override + public void onError(Exception e) { + Assertions.assertThat(e.getCause().getMessage()) + .isEqualTo("Read call frame size failed"); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.sayHello("US", "Bob", callback)); + } + + public void syncFramedClientSayHello(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.sayHello("US", "Bob")); + Assertions.assertThat(response).isEqualTo("Hello USs' Bob"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFastFramedClientSayHello(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFastFramedTransport framedTransport = new TFastFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.sayHello("US", "Bob")); + Assertions.assertThat(response).isEqualTo("Hello USs' Bob"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFramedClientMultiSayHello(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + String response = this.testing().runWithSpan("parent", () -> client.sayHello("US", "Bob")); + Assertions.assertThat(response).isEqualTo("Hello USs' Bob"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientSayHello(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.sayHello("US", "Bob")); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/TestSaslCallbackHandler.java b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/TestSaslCallbackHandler.java new file mode 100644 index 000000000000..c567c4cc87cf --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/TestSaslCallbackHandler.java @@ -0,0 +1,47 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_2; + +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.NameCallback; +import javax.security.auth.callback.PasswordCallback; +import javax.security.auth.callback.UnsupportedCallbackException; +import javax.security.sasl.AuthorizeCallback; +import javax.security.sasl.RealmCallback; + +public class TestSaslCallbackHandler implements CallbackHandler { + public static final String PRINCIPAL = "thrift-test-principal"; + public static final String REALM = "thrift-test-realm"; + private final String password; + + public TestSaslCallbackHandler(String password) { + this.password = password; + } + + @Override + public void handle(Callback[] callbacks) throws UnsupportedCallbackException { + Callback[] var2 = callbacks; + int var3 = callbacks.length; + + for (int var4 = 0; var4 < var3; ++var4) { + Callback c = var2[var4]; + if (c instanceof NameCallback) { + ((NameCallback) c).setName("thrift-test-principal"); + } else if (c instanceof PasswordCallback) { + ((PasswordCallback) c).setPassword(this.password.toCharArray()); + } else if (c instanceof AuthorizeCallback) { + ((AuthorizeCallback) c).setAuthorized(true); + } else { + if (!(c instanceof RealmCallback)) { + throw new UnsupportedCallbackException(c); + } + + ((RealmCallback) c).setText("thrift-test-realm"); + } + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/ThriftBaseTest.java b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/ThriftBaseTest.java new file mode 100644 index 000000000000..8e84efb2a2a6 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/ThriftBaseTest.java @@ -0,0 +1,986 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_2; + +import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo; +import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.satisfies; + +import com.google.common.base.VerifyException; +import io.opentelemetry.api.common.AttributeKey; +import io.opentelemetry.api.trace.SpanKind; +import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension; +import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; +import io.opentelemetry.instrumentation.thrift.v0_9_2.server.ThriftServiceAsyncImpl; +import io.opentelemetry.instrumentation.thrift.v0_9_2.server.ThriftServiceImpl; +import io.opentelemetry.instrumentation.thrift.v0_9_2.thrift.ThriftService; +import io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions; +import io.opentelemetry.sdk.testing.assertj.SpanDataAssert; +import io.opentelemetry.sdk.testing.assertj.TraceAssert; +import io.opentelemetry.sdk.trace.data.StatusData; +import io.opentelemetry.semconv.SemanticAttributes; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.nio.charset.Charset; +import java.util.Random; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.function.Consumer; +import java.util.logging.Logger; +import org.apache.thrift.TMultiplexedProcessor; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.server.THsHaServer; +import org.apache.thrift.server.TNonblockingServer; +import org.apache.thrift.server.TServer; +import org.apache.thrift.server.TSimpleServer; +import org.apache.thrift.server.TThreadPoolServer; +import org.apache.thrift.server.TThreadedSelectorServer; +import org.apache.thrift.transport.TFastFramedTransport; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingServerSocket; +import org.apache.thrift.transport.TNonblockingServerTransport; +import org.apache.thrift.transport.TServerSocket; +import org.apache.thrift.transport.TServerTransport; +import org.apache.thrift.transport.TTransportException; +import org.assertj.core.api.AbstractAssert; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.extension.RegisterExtension; + +public abstract class ThriftBaseTest { + private static final Logger logger = Logger.getLogger(ThriftBaseTest.class.getName()); + public TServer server; + public int port = 13100; + + private static final String ASYNC_CLIENT = + "io.opentelemetry.instrumentation.thrift.v0_9_2.thrift.ThriftService$AsyncClient"; + private static final String SYNC_CLIENT = + "io.opentelemetry.instrumentation.thrift.v0_9_2.thrift.ThriftService$Client"; + private static final String ASYNC_SERVER = + "io.opentelemetry.instrumentation.thrift.v0_9_2.server.ThriftServiceAsyncImpl"; + private static final String SYNC_SERVER = + "io.opentelemetry.instrumentation.thrift.v0_9_2.server.ThriftServiceImpl"; + private static final String PEER_NAME = "localhost"; + private static final String PEER_ADDR = "127.0.0.1"; + + private static final String TRANSPORT_EXCEPTION = + "org.apache.thrift.transport.TTransportException"; + private static final String VERIFY_EXCEPTION = "com.google.common.base.VerifyException"; + // private static final String APP_EXCEPTION = "org.apache.thrift.TApplicationException"; + private static final String IO_EXCEPTION = "java.io.IOException"; + + @RegisterExtension + static InstrumentationExtension testing = AgentInstrumentationExtension.create(); + + protected InstrumentationExtension testing() { + return testing; + } + + @BeforeEach + public void before() { + System.setProperty("otel.javaagent.debug", "true"); + ++this.port; + logger.info( + "before port=" + + this.port + + ", threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.testing().clearData(); + } + + @AfterEach + public void after() throws InterruptedException { + this.stopServer(); + } + + public int getPort() { + Random random = new Random(); + int newPort = this.port + random.nextInt(2000); + while (portNotRelease(newPort)) { + newPort = this.port + random.nextInt(2000); + } + return newPort; + } + + public static boolean portNotRelease(int port) { + Process process = null; + String pid = null; + try { + process = Runtime.getRuntime().exec("lsof -ti:" + port); + BufferedReader reader = + new BufferedReader( + new InputStreamReader(process.getInputStream(), Charset.defaultCharset())); + pid = reader.readLine(); + } catch (IOException e) { + throw new VerifyException(e); + } + return pid != null && !pid.isEmpty(); + } + + public void startSyncSimpleServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TServerTransport serverTransport = new TServerSocket(port); + this.server = new TSimpleServer(new TServer.Args(serverTransport).processor(processor)); + new Thread( + () -> { + logger.info( + "Starting startSyncSimpleServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startAsyncSimpleServer(int port) throws TTransportException { + ThriftServiceAsyncImpl impl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor processor = + new ThriftService.AsyncProcessor(impl); + TServerTransport serverTransport = new TServerSocket(port); + this.server = new TSimpleServer(new TServer.Args(serverTransport).processor(processor)); + new Thread( + () -> { + logger.info( + "Starting startAsyncSimpleServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startMultiSimpleServer(int port) throws TTransportException { + ThriftServiceImpl syncImpl = new ThriftServiceImpl(); + ThriftService.Processor syncProcessor = + new ThriftService.Processor(syncImpl); + ThriftServiceAsyncImpl asyncImpl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor asyncProcessor = + new ThriftService.AsyncProcessor(asyncImpl); + TMultiplexedProcessor multiplexedProcessor = new TMultiplexedProcessor(); + multiplexedProcessor.registerProcessor("syncHelloWorld", syncProcessor); + multiplexedProcessor.registerProcessor("asyncHelloWorld", asyncProcessor); + TServerTransport serverTransport = new TServerSocket(port); + this.server = + new TSimpleServer(new TServer.Args(serverTransport).processor(multiplexedProcessor)); + new Thread( + () -> { + logger.info( + "Starting startMultiSimpleServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startMultiThreadedSelectorServer(int port) throws TTransportException { + ThriftServiceImpl syncImpl = new ThriftServiceImpl(); + ThriftService.Processor syncProcessor = + new ThriftService.Processor(syncImpl); + ThriftServiceAsyncImpl asyncImpl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor asyncProcessor = + new ThriftService.AsyncProcessor(asyncImpl); + TMultiplexedProcessor multiplexedProcessor = new TMultiplexedProcessor(); + multiplexedProcessor.registerProcessor("syncHelloWorld", syncProcessor); + multiplexedProcessor.registerProcessor("asyncHelloWorld", asyncProcessor); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TThreadedSelectorServer.Args serverArgs = + new TThreadedSelectorServer.Args(transport) + .selectorThreads(5) + .workerThreads(10) + .acceptQueueSizePerThread(20) + .processor(multiplexedProcessor); + this.server = new TThreadedSelectorServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startMultiThreadedSelectorServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startSyncThreadedSelectorServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TThreadedSelectorServer.Args serverArgs = + new TThreadedSelectorServer.Args(transport) + .selectorThreads(5) + .workerThreads(10) + .acceptQueueSizePerThread(20) + .processor(processor); + this.server = new TThreadedSelectorServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startAsyncServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startSyncThreadedSelectorFastServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TThreadedSelectorServer.Args serverArgs = + new TThreadedSelectorServer.Args(transport) + .selectorThreads(5) + .workerThreads(10) + .acceptQueueSizePerThread(20) + .processor(processor) + .transportFactory(new TFastFramedTransport.Factory()); + this.server = new TThreadedSelectorServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startAsyncServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startAsyncThreadedSelectorServer(int port) throws TTransportException { + ThriftServiceAsyncImpl impl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor processor = + new ThriftService.AsyncProcessor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TThreadedSelectorServer.Args serverArgs = + new TThreadedSelectorServer.Args(transport) + .selectorThreads(5) + .workerThreads(10) + .acceptQueueSizePerThread(20) + .processor(processor); + this.server = new TThreadedSelectorServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startNonBlockingServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startAsyncThreadedSelectorFastServer(int port) throws TTransportException { + ThriftServiceAsyncImpl impl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor processor = + new ThriftService.AsyncProcessor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TThreadedSelectorServer.Args serverArgs = + new TThreadedSelectorServer.Args(transport) + .selectorThreads(5) + .workerThreads(10) + .acceptQueueSizePerThread(20) + .processor(processor) + .transportFactory(new TFastFramedTransport.Factory()); + this.server = new TThreadedSelectorServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startNonBlockingServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startSyncNonblockingServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TNonblockingServer.Args serverArgs = + new TNonblockingServer.Args(transport).processor(processor); + this.server = new TNonblockingServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startNonBlockingServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startSyncNonblockingFastServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TNonblockingServer.Args serverArgs = + new TNonblockingServer.Args(transport) + .processor(processor) + .transportFactory(new TFastFramedTransport.Factory()) + .protocolFactory(new TBinaryProtocol.Factory()); + this.server = new TNonblockingServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startNonBlockingServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startAsyncNonblockingServer(int port) throws TTransportException { + ThriftServiceAsyncImpl impl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor processor = + new ThriftService.AsyncProcessor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TNonblockingServer.Args serverArgs = + new TNonblockingServer.Args(transport).processor(processor); + this.server = new TNonblockingServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startNonBlockingServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startAsyncThreadPoolServer(int port) throws TTransportException { + ThriftServiceAsyncImpl impl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor processor = + new ThriftService.AsyncProcessor(impl); + TServerSocket transport = new TServerSocket(port); + TThreadPoolServer.Args serverArgs = + new TThreadPoolServer.Args(transport) + .minWorkerThreads(5) + .maxWorkerThreads(10) + .processor(processor); + TServer server = new TThreadPoolServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startNonBlockingServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + server.serve(); + }) + .start(); + } + + public void startSyncThreadPoolServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TServerSocket transport = new TServerSocket(port); + ExecutorService executor = Executors.newFixedThreadPool(5); + TThreadPoolServer.Args serverArgs = + new TThreadPoolServer.Args(transport).executorService(executor).processor(processor); + TServer server = new TThreadPoolServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startSyncThreadPoolServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + server.serve(); + }) + .start(); + } + + public void startSyncHsHaServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TBinaryProtocol.Factory protocolFactory = new TBinaryProtocol.Factory(); + TFramedTransport.Factory transportFactory = new TFramedTransport.Factory(); + THsHaServer.Args serverArgs = + new THsHaServer.Args(transport) + .processor(processor) + .protocolFactory(protocolFactory) + .transportFactory(transportFactory); + this.server = new THsHaServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startSyncTHsHaServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startSyncHsHaFastServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TBinaryProtocol.Factory protocolFactory = new TBinaryProtocol.Factory(); + TFastFramedTransport.Factory transportFactory = new TFastFramedTransport.Factory(); + THsHaServer.Args serverArgs = + new THsHaServer.Args(transport) + .processor(processor) + .protocolFactory(protocolFactory) + .transportFactory(transportFactory); + this.server = new THsHaServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startSyncTHsHaServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startAsyncHsHaServer(int port) throws TTransportException { + ThriftServiceAsyncImpl impl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor processor = + new ThriftService.AsyncProcessor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TBinaryProtocol.Factory protocolFactory = new TBinaryProtocol.Factory(); + TFramedTransport.Factory transportFactory = new TFramedTransport.Factory(); + THsHaServer.Args serverArgs = + new THsHaServer.Args(transport) + .processor(processor) + .protocolFactory(protocolFactory) + .transportFactory(transportFactory); + this.server = new THsHaServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startAsyncTHsHaServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startAsyncHsHaFastServer(int port) throws TTransportException { + ThriftServiceAsyncImpl impl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor processor = + new ThriftService.AsyncProcessor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TBinaryProtocol.Factory protocolFactory = new TBinaryProtocol.Factory(); + TFastFramedTransport.Factory transportFactory = new TFastFramedTransport.Factory(); + THsHaServer.Args serverArgs = + new THsHaServer.Args(transport) + .processor(processor) + .protocolFactory(protocolFactory) + .transportFactory(transportFactory); + this.server = new THsHaServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startAsyncTHsHaServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void stopServer() { + if (this.server != null) { + this.server.stop(); + logger.info( + "Server stopped" + + ", threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + } + } + + public void waitAndAssertTracesClientSyncServerSync(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.unset(), + null, + null); + } + + public void waitAndAssertTracesClientSyncServerSync( + String clientMethod, String serverMethod, int count) { + this.baseWaitAndAssertTraces( + clientMethod, + serverMethod, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.unset(), + null, + null); + } + + @SuppressWarnings("UngroupedOverloads") + public void waitAndAssertTracesClientSyncServerSyncWithError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> val.isIn(null, "Internal error processing " + method), + TRANSPORT_EXCEPTION, + SYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientSyncServerSyncWithError( + String clientMethod, String serverMethod, int count) { + this.baseWaitAndAssertTraces( + clientMethod, + serverMethod, + count, + SYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> val.isIn(null, "Internal error processing " + clientMethod), + TRANSPORT_EXCEPTION, + SYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientSyncServerSyncOnewayError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientSyncServerSyncOnewayError( + String clientMethod, String serverMethod, int count) { + this.baseWaitAndAssertTraces( + clientMethod, + serverMethod, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientAsyncServerAsync(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + ASYNC_SERVER, + StatusData.unset(), + null, + null); + } + + public void waitAndAssertTracesClientAsyncServerAsyncError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + ASYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientAsyncServerAsyncWithError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> val.isIn("Read call frame size failed", "fail"), + IO_EXCEPTION, + ASYNC_SERVER, + StatusData.error(), + val -> val.isIn("Read call frame size failed", "fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientAsyncServerSync(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.unset(), + null, + null); + } + + public void waitAndAssertTracesClientAsyncServerSyncWithError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> val.isIn("Read call frame size failed", "Internal error processing " + method), + IO_EXCEPTION, + SYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientAsyncServerSyncOnewayError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) // 测试代码 + public void waitAndAssertTracesClientSyncServerAsync(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + ASYNC_SERVER, + StatusData.unset(), + null, + null); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) // 测试代码 + public void waitAndAssertTracesClientSyncServerAsyncError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + ASYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) // 测试代码 + public void waitAndAssertTracesClientSyncServerAsyncWithError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> val.isIn(null, "fail"), + TRANSPORT_EXCEPTION, + ASYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientSyncNoServer(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> + val.isIn( + null, "Socket is closed by peer.", "java.net.SocketException: Connection reset"), + TRANSPORT_EXCEPTION, + null, + null, + null, + null); + } + + public void waitAndAssertTracesClientSyncNoServerOneway(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + null, + null, + null, + null); + } + + public void waitAndAssertTracesClientSyncNoServerNoSasl(String method, int count) { + this.baseWaitAndAssertTraces( + method, + null, + count, + SYNC_CLIENT, + StatusData.error(), + null, + null, + val -> val.isIn("SASL authentication not complete"), + TRANSPORT_EXCEPTION, + null, + null, + null, + null); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) // 测试代码 + private void baseWaitAndAssertTraces( + String clientMethod, + String serverMethod, + int count, + String clientClass, + StatusData clientStatus, + String peerName, + String peerAddr, + OpenTelemetryAssertions.StringAssertConsumer clientAssertion, + String clientErrorType, + String serverClass, + StatusData serverStatus, + OpenTelemetryAssertions.StringAssertConsumer serviceAssertion, + String serverErrorType) { + Consumer[] consumers = new Consumer[count]; + Consumer traceAssertConsumer; + if (serverClass == null) { + traceAssertConsumer = + trace -> + trace.hasSpansSatisfyingExactly( + span -> span.hasName("parent").hasKind(SpanKind.INTERNAL).hasNoParent(), + clientSpanDataAssertConsumer( + clientMethod, + clientClass, + clientStatus, + trace, + peerName, + peerAddr, + clientAssertion, + clientErrorType)); + } else { + traceAssertConsumer = + trace -> + trace.hasSpansSatisfyingExactly( + span -> span.hasName("parent").hasKind(SpanKind.INTERNAL).hasNoParent(), + clientSpanDataAssertConsumer( + clientMethod, + clientClass, + clientStatus, + trace, + peerName, + peerAddr, + clientAssertion, + clientErrorType), + serverSpanDataAssertConsumer( + serverMethod, + serverClass, + serverStatus, + trace, + serviceAssertion, + serverErrorType)); + } + + for (int i = 0; i < count; ++i) { + consumers[i] = traceAssertConsumer; + } + this.testing().waitAndAssertTraces(consumers); + } + + @SuppressWarnings({"ReturnValueIgnored"}) + private static Consumer clientSpanDataAssertConsumer( + String clientMethod, + String clientClass, + StatusData statusData, + TraceAssert trace, + String peerName, + String peerAddr, + OpenTelemetryAssertions.StringAssertConsumer errorMsgAssertion, + String errorType) { + Consumer consumer = + span -> + span.hasName(clientMethod) + .hasKind(SpanKind.CLIENT) + .hasParent(trace.getSpan(0)) + .hasStatus(statusData) + .hasAttributesSatisfying( + equalTo(AttributeKey.stringKey("net.sock.peer.name"), peerName), + equalTo(AttributeKey.stringKey("net.sock.peer.addr"), peerAddr), + equalTo(SemanticAttributes.RPC_SYSTEM, "thrift"), + equalTo(SemanticAttributes.RPC_SERVICE, clientClass), + equalTo(SemanticAttributes.RPC_METHOD, clientMethod)); + if (statusData == StatusData.error()) { + consumer = + consumer.andThen( + span -> + span.hasEventsSatisfyingExactly( + event -> + event + .hasName(SemanticAttributes.EXCEPTION_EVENT_NAME) + .hasAttributesSatisfyingExactly( + satisfies( + SemanticAttributes.EXCEPTION_MESSAGE, errorMsgAssertion), + satisfies( + AttributeKey.stringKey("exception.stacktrace"), + AbstractAssert::isNotNull), + equalTo(SemanticAttributes.EXCEPTION_TYPE, errorType)))); + } + return consumer; + } + + @SuppressWarnings({"ReturnValueIgnored"}) + private static Consumer serverSpanDataAssertConsumer( + String serverMethod, + String serverClass, + StatusData statusData, + TraceAssert trace, + OpenTelemetryAssertions.StringAssertConsumer errorMsgAssertion, + String errorType) { + Consumer consumer = + span -> + span.hasName(serverMethod) + .hasKind(SpanKind.SERVER) + .hasParent(trace.getSpan(1)) + .hasStatus(statusData) + .hasAttributesSatisfying( + equalTo(AttributeKey.stringKey("net.sock.peer.addr"), "127.0.0.1"), + equalTo(SemanticAttributes.RPC_SYSTEM, "thrift"), + equalTo(SemanticAttributes.RPC_SERVICE, serverClass), + equalTo(SemanticAttributes.RPC_METHOD, serverMethod)); + if (statusData == StatusData.error()) { + consumer = + consumer.andThen( + span -> + span.hasEventsSatisfyingExactly( + event -> + event + .hasName(SemanticAttributes.EXCEPTION_EVENT_NAME) + .hasAttributesSatisfyingExactly( + satisfies( + SemanticAttributes.EXCEPTION_MESSAGE, errorMsgAssertion), + satisfies( + AttributeKey.stringKey("exception.stacktrace"), + AbstractAssert::isNotNull), + equalTo(SemanticAttributes.EXCEPTION_TYPE, errorType)))); + } + return consumer; + } +} diff --git a/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/WithDelayTest.java b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/WithDelayTest.java new file mode 100644 index 000000000000..959cd57fc765 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/WithDelayTest.java @@ -0,0 +1,995 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_2; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_9_2.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public abstract class WithDelayTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerSayHello() throws TException { + this.startSyncSimpleServer(this.port); + this.syncClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", 1); + } + + @Test + public void syncClientSyncSimpleServerSayHelloMuti() throws TException { + this.startSyncSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithDelay(this.port, 2); + } + this.waitAndAssertTracesClientSyncServerSync("withDelay", 5); + } + + @Test + public void syncClientSyncSimpleServerSayHelloParallel() throws TException, InterruptedException { + this.startSyncSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithDelay(this.port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withDelay", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerSayHello() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientWithDelay(port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", 1); + } + + @Test + public void syncClientSyncThreadPoolServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithDelay(port, 2); + } + this.waitAndAssertTracesClientSyncServerSync("withDelay", 5); + } + + @Test + public void syncClientSyncThreadPoolServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithDelay(port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withDelay", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerSayHello() throws TException { + this.startMultiSimpleServer(this.port); + this.syncClientMultiWithDelay(this.port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", "syncHelloWorld:withDelay", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerSayHelloMuti() throws TException { + this.startMultiSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiWithDelay(this.port, 2); + } + this.waitAndAssertTracesClientSyncServerSync("withDelay", "syncHelloWorld:withDelay", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerSayHelloParallel() + throws TException, InterruptedException { + this.startMultiSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiWithDelay(this.port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "withDelay", "syncHelloWorld:withDelay", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerSayHelloError() { + Exception error = null; + try { + this.startSyncThreadedSelectorServer(this.port); + this.syncClientWithDelay(this.port, 2); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withDelay", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerSayHelloError() { + Exception error = null; + try { + this.startAsyncThreadedSelectorServer(this.port); + this.syncClientWithDelay(this.port, 2); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withDelay", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerSayHello() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + this.syncFramedClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientSyncServerAsync("withDelay", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerSayHelloMuti() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientSyncServerAsync("withDelay", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithDelay(this.port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("withDelay", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerSayHello() throws TException { + this.startMultiThreadedSelectorServer(this.port); + this.syncFramedClientMultiWithDelay(this.port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", "syncHelloWorld:withDelay", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerSayHelloMuti() throws TException { + this.startMultiThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientSyncServerSync("withDelay", "syncHelloWorld:withDelay", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + this.startMultiThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiWithDelay(this.port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "withDelay", "syncHelloWorld:withDelay", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerSayHello() throws TException { + this.startSyncThreadedSelectorServer(this.port); + this.syncFramedClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerSayHelloMuti() throws TException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientSyncServerSync("withDelay", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithDelay(this.port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withDelay", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerSayHello() throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + this.nonBlockClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerSayHelloMuti() + throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithDelay(this.port, 2); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerSayHello() throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + this.nonBlockClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerSayHelloMuti() + throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithDelay(this.port, 2); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHello() throws TException { + this.startSyncNonblockingServer(this.port); + this.syncFramedClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHelloMuti() throws TException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientSyncServerSync("withDelay", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithDelay(this.port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withDelay", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHello() throws TException { + this.startSyncHsHaServer(this.port); + this.syncFramedClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHelloMuti() throws TException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientSyncServerSync("withDelay", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithDelay(this.port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withDelay", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerSayHello() throws TException { + this.startAsyncNonblockingServer(this.port); + this.syncFramedClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientSyncServerAsync("withDelay", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerSayHelloMuti() throws TException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientSyncServerAsync("withDelay", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithDelay(this.port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("withDelay", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerSayHello() throws TException { + this.startAsyncHsHaServer(this.port); + this.syncFramedClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientSyncServerAsync("withDelay", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerSayHelloMuti() throws TException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientSyncServerAsync("withDelay", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithDelay(this.port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("withDelay", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHello() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + this.nonBlockClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHelloMuti() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithDelay(this.port, 1); + } + + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithDelay(this.port, 1); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHello() throws TException, IOException { + this.startSyncHsHaServer(this.port); + this.nonBlockClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHelloMuti() throws TException, IOException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithDelay(this.port, 2); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerSayHelloError() { + Exception error = null; + try { + this.startAsyncNonblockingServer(this.port); + this.syncClientWithDelay(this.port, 2); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withDelay", 1); + } + + @Test + public void syncClientSyncNonblockingServerSayHelloError() { + Exception error = null; + try { + this.startSyncNonblockingServer(this.port); + this.syncClientWithDelay(this.port, 2); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withDelay", 1); + } + + @Test + public void syncClientAsyncHsHaServerSayHelloError() { + Exception error = null; + try { + this.startAsyncHsHaServer(this.port); + this.syncClientWithDelay(this.port, 2); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withDelay", 1); + } + + @Test + public void syncClientSyncHsHaServerSayHelloError() { + Exception error = null; + try { + this.startSyncHsHaServer(this.port); + this.syncClientWithDelay(this.port, 2); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withDelay", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerSayHello() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + this.nonBlockClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerSayHelloMuti() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithDelay(this.port, 2); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerSayHello() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + this.nonBlockClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerSayHelloMuti() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithDelay(this.port, 2); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", threadCount); + } + + public void syncClientWithDelay(int port, int delay) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.withDelay(delay)); + Assertions.assertThat(response).isEqualTo("delay " + delay); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncClientMultiWithDelay(int port, int delay) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + String response = this.testing().runWithSpan("parent", () -> client.withDelay(delay)); + Assertions.assertThat(response).isEqualTo("delay " + delay); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientWithDelay(int port, int delay) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.withDelay_call s) { + try { + String result = s.getResult(); + Assertions.assertThat(result).isEqualTo("delay " + delay); + } catch (TException e) { + throw new VerifyException(e); + } + } + + @Override + public void onError(Exception e) { + Assertions.assertThat(e.getCause().getMessage()) + .isEqualTo("Read call frame size failed"); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.withDelay(delay, callback)); + } + + public void syncFramedClientWithDelay(int port, int delay) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.withDelay(delay)); + Assertions.assertThat(response).isEqualTo("delay " + delay); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFramedClientMultiWithDelay(int port, int delay) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + String response = this.testing().runWithSpan("parent", () -> client.withDelay(delay)); + Assertions.assertThat(response).isEqualTo("delay " + delay); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientWithDelay(int port, int delay) throws IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withDelay(delay)); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/WithErrorTest.java b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/WithErrorTest.java new file mode 100644 index 000000000000..ff57f36c245b --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/WithErrorTest.java @@ -0,0 +1,1023 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_2; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_9_2.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class WithErrorTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerWithError() throws TException { + this.startSyncSimpleServer(this.port); + this.syncClientWithError(this.port); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 1); + } + + @Test + public void syncClientSyncSimpleServerWithErrorMuti() throws TException { + this.startSyncSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithError(this.port); + } + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 5); + } + + @Test + public void syncClientSyncSimpleServerWithErrorParallel() + throws TException, InterruptedException { + this.startSyncSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerWithError() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientWithError(port); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 1); + } + + @Test + public void syncClientSyncThreadPoolServerWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithError(port); + } + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 5); + } + + @Test + public void syncClientSyncThreadPoolServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerWithError() throws TException { + this.startMultiSimpleServer(this.port); + this.syncClientMultiWithError(this.port); + this.waitAndAssertTracesClientSyncServerSyncWithError( + "withError", "syncHelloWorld:withError", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerWithErrorMuti() throws TException { + this.startMultiSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiWithError(this.port); + } + this.waitAndAssertTracesClientSyncServerSyncWithError( + "withError", "syncHelloWorld:withError", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerWithErrorParallel() + throws TException, InterruptedException { + this.startMultiSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError( + "withError", "syncHelloWorld:withError", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerWithErrorError() { + Exception error = null; + try { + this.startSyncThreadedSelectorServer(this.port); + this.syncClientWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServer("withError", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerWithErrorError() { + Exception error = null; + try { + this.startAsyncThreadedSelectorServer(this.port); + this.syncClientWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServer("withError", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithError() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + this.syncFramedClientWithError(this.port); + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithErrorMuti() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithError() throws TException { + this.startMultiThreadedSelectorServer(this.port); + this.syncFramedClientMultiWithError(this.port); + this.waitAndAssertTracesClientSyncServerSyncWithError( + "withError", "syncHelloWorld:withError", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithErrorMuti() throws TException { + this.startMultiThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerSyncWithError( + "withError", "syncHelloWorld:withError", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithErrorParallel() + throws TException, InterruptedException { + this.startMultiThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError( + "withError", "syncHelloWorld:withError", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithError() throws TException { + this.startSyncThreadedSelectorServer(this.port); + this.syncFramedClientWithError(this.port); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithErrorMuti() throws TException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithErrorParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithError() throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + this.nonBlockClientWithError(this.port); + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithErrorMuti() + throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithError() throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + this.nonBlockClientWithError(this.port); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithErrorMuti() + throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithErrorParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithError() throws TException { + this.startSyncNonblockingServer(this.port); + this.syncFramedClientWithError(this.port); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithErrorMuti() throws TException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithErrorParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerWithError() throws TException { + this.startSyncHsHaServer(this.port); + this.syncFramedClientWithError(this.port); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerWithErrorMuti() throws TException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerWithErrorParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithError() throws TException { + this.startAsyncNonblockingServer(this.port); + this.syncFramedClientWithError(this.port); + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithErrorMuti() throws TException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithError() throws TException { + this.startAsyncHsHaServer(this.port); + this.syncFramedClientWithError(this.port); + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithErrorMuti() throws TException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithError() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + this.nonBlockClientWithError(this.port); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithErrorMuti() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithErrorParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerWithError() throws TException, IOException { + this.startSyncHsHaServer(this.port); + this.nonBlockClientWithError(this.port); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerWithErrorMuti() throws TException, IOException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerWithErrorParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerWithErrorError() { + Exception error = null; + try { + this.startAsyncNonblockingServer(this.port); + this.syncClientWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServer("withError", 1); + } + + @Test + public void syncClientSyncNonblockingServerWithErrorError() { + Exception error = null; + try { + this.startSyncNonblockingServer(this.port); + this.syncClientWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServer("withError", 1); + } + + @Test + public void syncClientAsyncHsHaServerWithErrorError() { + Exception error = null; + try { + this.startAsyncHsHaServer(this.port); + this.syncClientWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServer("withError", 1); + } + + @Test + public void syncClientSyncHsHaServerWithErrorError() { + Exception error = null; + try { + this.startSyncHsHaServer(this.port); + this.syncClientWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServer("withError", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithError() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + this.nonBlockClientWithError(this.port); + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithErrorMuti() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithError() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + this.nonBlockClientWithError(this.port); + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithErrorMuti() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", threadCount); + } + + public void syncClientWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncClientMultiWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientWithError(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.withError_call s) { + try { + String result = s.getResult(); + Assertions.assertThat(result).isEqualTo("Hello USs' Bob"); + } catch (TException e) { + throw new VerifyException(e); + } + } + + @Override + public void onError(Exception e) { + Assertions.assertThat(e.getCause().getMessage()) + .isEqualTo("Read call frame size failed"); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.withError(callback)); + } + + public void syncFramedClientWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFramedClientMultiWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientWithError(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/WithStructTest.java b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/WithStructTest.java new file mode 100644 index 000000000000..4a34fce9e84a --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/WithStructTest.java @@ -0,0 +1,1014 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_2; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_9_2.thrift.Account; +import io.opentelemetry.instrumentation.thrift.v0_9_2.thrift.ThriftService; +import io.opentelemetry.instrumentation.thrift.v0_9_2.thrift.User; +import io.opentelemetry.instrumentation.thrift.v0_9_2.thrift.UserAccount; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class WithStructTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerWithStruct() throws TException { + this.startSyncSimpleServer(this.port); + this.syncClientWithStruct(this.port); + this.waitAndAssertTracesClientSyncServerSync("data", 1); + } + + @Test + public void syncClientSyncSimpleServerWithStructMuti() throws TException { + this.startSyncSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithStruct(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("data", 5); + } + + @Test + public void syncClientSyncSimpleServerWithStructParallel() + throws TException, InterruptedException { + this.startSyncSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithStruct(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerWithStruct() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientWithStruct(port); + this.waitAndAssertTracesClientSyncServerSync("data", 1); + } + + @Test + public void syncClientSyncThreadPoolServerWithStructMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithStruct(port); + } + this.waitAndAssertTracesClientSyncServerSync("data", 5); + } + + @Test + public void syncClientSyncThreadPoolServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithStruct(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerWithStruct() throws TException { + this.startMultiSimpleServer(this.port); + this.syncClientMultiWithStruct(this.port); + this.waitAndAssertTracesClientSyncServerSync("data", "syncHelloWorld:data", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerWithStructMuti() throws TException { + this.startMultiSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiWithStruct(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("data", "syncHelloWorld:data", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerWithStructParallel() + throws TException, InterruptedException { + this.startMultiSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiWithStruct(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", "syncHelloWorld:data", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerWithStructError() { + Exception error = null; + try { + this.startSyncThreadedSelectorServer(this.port); + this.syncClientWithStruct(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("data", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerWithStructError() { + Exception error = null; + try { + this.startAsyncThreadedSelectorServer(this.port); + this.syncClientWithStruct(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("data", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithStruct() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + this.syncFramedClientWithStruct(this.port); + this.waitAndAssertTracesClientSyncServerAsync("data", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithStructMuti() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("data", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithStructParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithStruct(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("data", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithStruct() throws TException { + this.startMultiThreadedSelectorServer(this.port); + this.syncFramedClientMultiWithStruct(this.port); + this.waitAndAssertTracesClientSyncServerSync("data", "syncHelloWorld:data", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithStructMuti() throws TException { + this.startMultiThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiWithStruct(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("data", "syncHelloWorld:data", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithStructParallel() + throws TException, InterruptedException { + this.startMultiThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiWithStruct(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", "syncHelloWorld:data", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithStruct() throws TException { + this.startSyncThreadedSelectorServer(this.port); + this.syncFramedClientWithStruct(this.port); + this.waitAndAssertTracesClientSyncServerSync("data", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithStructMuti() throws TException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("data", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithStructParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithStruct(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithStruct() throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + this.nonBlockClientWithStruct(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("data", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithStructMuti() + throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("data", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithStructParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithStruct(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("data", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithStruct() throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + this.nonBlockClientWithStruct(this.port); + this.waitAndAssertTracesClientAsyncServerSync("data", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithStructMuti() + throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("data", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithStructParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithStruct(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("data", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithStruct() throws TException { + this.startSyncNonblockingServer(this.port); + this.syncFramedClientWithStruct(this.port); + this.waitAndAssertTracesClientSyncServerSync("data", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithStructMuti() throws TException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("data", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithStructParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithStruct(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerWithStruct() throws TException { + this.startSyncHsHaServer(this.port); + this.syncFramedClientWithStruct(this.port); + this.waitAndAssertTracesClientSyncServerSync("data", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerWithStructMuti() throws TException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("data", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerWithStructParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithStruct(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithStruct() throws TException { + this.startAsyncNonblockingServer(this.port); + this.syncFramedClientWithStruct(this.port); + this.waitAndAssertTracesClientSyncServerAsync("data", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithStructMuti() throws TException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("data", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithStructParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithStruct(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("data", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithStruct() throws TException { + this.startAsyncHsHaServer(this.port); + this.syncFramedClientWithStruct(this.port); + this.waitAndAssertTracesClientSyncServerAsync("data", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithStructMuti() throws TException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("data", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithStructParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithStruct(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("data", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithStruct() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + this.nonBlockClientWithStruct(this.port); + this.waitAndAssertTracesClientAsyncServerSync("data", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithStructMuti() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("data", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithStructParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithStruct(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("data", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerWithStruct() throws TException, IOException { + this.startSyncHsHaServer(this.port); + this.nonBlockClientWithStruct(this.port); + this.waitAndAssertTracesClientAsyncServerSync("data", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerWithStructMuti() throws TException, IOException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("data", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerWithStructParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithStruct(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("data", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerWithStructError() { + Exception error = null; + try { + this.startAsyncNonblockingServer(this.port); + this.syncClientWithStruct(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("data", 1); + } + + @Test + public void syncClientSyncNonblockingServerWithStructError() { + Exception error = null; + try { + this.startSyncNonblockingServer(this.port); + this.syncClientWithStruct(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("data", 1); + } + + @Test + public void syncClientAsyncHsHaServerWithStructError() { + Exception error = null; + try { + this.startAsyncHsHaServer(this.port); + this.syncClientWithStruct(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("data", 1); + } + + @Test + public void syncClientSyncHsHaServerWithStructError() { + Exception error = null; + try { + this.startSyncHsHaServer(this.port); + this.syncClientWithStruct(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("data", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithStruct() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + this.nonBlockClientWithStruct(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("data", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithStructMuti() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("data", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithStructParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithStruct(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("data", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithStruct() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + this.nonBlockClientWithStruct(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("data", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithStructMuti() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("data", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithStructParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithStruct(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("data", threadCount); + } + + public void syncClientWithStruct(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + UserAccount response = this.testing().runWithSpan("parent", () -> client.data(user, account)); + Assertions.assertThat(response.user).isEqualTo(user); + Assertions.assertThat(response.account).isEqualTo(account); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncClientMultiWithStruct(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + UserAccount response = this.testing().runWithSpan("parent", () -> client.data(user, account)); + Assertions.assertThat(response.user).isEqualTo(user); + Assertions.assertThat(response.account).isEqualTo(account); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientWithStruct(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.data_call response) { + try { + UserAccount result = response.getResult(); + Assertions.assertThat(result.user).isEqualTo(user); + Assertions.assertThat(result.account).isEqualTo(account); + } catch (TException e) { + throw new VerifyException(e); + } + } + + @Override + public void onError(Exception e) { + Assertions.assertThat(e.getCause().getMessage()) + .isEqualTo("Read call frame size failed"); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.data(user, account, callback)); + } + + public void syncFramedClientWithStruct(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + UserAccount response = this.testing().runWithSpan("parent", () -> client.data(user, account)); + Assertions.assertThat(response.user).isEqualTo(user); + Assertions.assertThat(response.account).isEqualTo(account); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFramedClientMultiWithStruct(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + UserAccount response = this.testing().runWithSpan("parent", () -> client.data(user, account)); + Assertions.assertThat(response.user).isEqualTo(user); + Assertions.assertThat(response.account).isEqualTo(account); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientWithStruct(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + UserAccount response = this.testing().runWithSpan("parent", () -> client.data(user, account)); + Assertions.assertThat(response.user).isEqualTo(user); + Assertions.assertThat(response.account).isEqualTo(account); + } +} diff --git a/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/WithoutArgsTest.java b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/WithoutArgsTest.java new file mode 100644 index 000000000000..1405098b8d9b --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/WithoutArgsTest.java @@ -0,0 +1,1000 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_2; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_9_2.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class WithoutArgsTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerWithoutArgs() throws TException { + this.startSyncSimpleServer(this.port); + this.syncClientWithoutArgs(this.port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 1); + } + + @Test + public void syncClientSyncSimpleServerWithoutArgsMuti() throws TException { + this.startSyncSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithoutArgs(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 5); + } + + @Test + public void syncClientSyncSimpleServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startSyncSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithoutArgs(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerWithoutArgs() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientWithoutArgs(port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 1); + } + + @Test + public void syncClientSyncThreadPoolServerWithoutArgsMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithoutArgs(port); + } + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 5); + } + + @Test + public void syncClientSyncThreadPoolServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithoutArgs(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerWithoutArgs() throws TException { + this.startMultiSimpleServer(this.port); + this.syncClientMultiWithoutArgs(this.port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", "syncHelloWorld:withoutArgs", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerWithoutArgsMuti() throws TException { + this.startMultiSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiWithoutArgs(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", "syncHelloWorld:withoutArgs", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startMultiSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiWithoutArgs(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "withoutArgs", "syncHelloWorld:withoutArgs", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerWithoutArgsError() { + Exception error = null; + try { + this.startSyncThreadedSelectorServer(this.port); + this.syncClientWithoutArgs(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withoutArgs", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerWithoutArgsError() { + Exception error = null; + try { + this.startAsyncThreadedSelectorServer(this.port); + this.syncClientWithoutArgs(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withoutArgs", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithoutArgs() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + this.syncFramedClientWithoutArgs(this.port); + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithoutArgsMuti() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithoutArgs(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithoutArgs() throws TException { + this.startMultiThreadedSelectorServer(this.port); + this.syncFramedClientMultiWithoutArgs(this.port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", "syncHelloWorld:withoutArgs", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithoutArgsMuti() throws TException { + this.startMultiThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", "syncHelloWorld:withoutArgs", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startMultiThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiWithoutArgs(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "withoutArgs", "syncHelloWorld:withoutArgs", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithoutArgs() throws TException { + this.startSyncThreadedSelectorServer(this.port); + this.syncFramedClientWithoutArgs(this.port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithoutArgsMuti() throws TException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithoutArgs(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithoutArgs() + throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + this.nonBlockClientWithoutArgs(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithoutArgsMuti() + throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithoutArgs(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithoutArgs() throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + this.nonBlockClientWithoutArgs(this.port); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithoutArgsMuti() + throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithoutArgs(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithoutArgs() throws TException { + this.startSyncNonblockingServer(this.port); + this.syncFramedClientWithoutArgs(this.port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithoutArgsMuti() throws TException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithoutArgs(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerWithoutArgs() throws TException { + this.startSyncHsHaServer(this.port); + this.syncFramedClientWithoutArgs(this.port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerWithoutArgsMuti() throws TException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithoutArgs(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithoutArgs() throws TException { + this.startAsyncNonblockingServer(this.port); + this.syncFramedClientWithoutArgs(this.port); + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithoutArgsMuti() throws TException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithoutArgs(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithoutArgs() throws TException { + this.startAsyncHsHaServer(this.port); + this.syncFramedClientWithoutArgs(this.port); + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithoutArgsMuti() throws TException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithoutArgs(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithoutArgs() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + this.nonBlockClientWithoutArgs(this.port); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithoutArgsMuti() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithoutArgs(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerWithoutArgs() throws TException, IOException { + this.startSyncHsHaServer(this.port); + this.nonBlockClientWithoutArgs(this.port); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerWithoutArgsMuti() throws TException, IOException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithoutArgs(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerWithoutArgsError() { + Exception error = null; + try { + this.startAsyncNonblockingServer(this.port); + this.syncClientWithoutArgs(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withoutArgs", 1); + } + + @Test + public void syncClientSyncNonblockingServerWithoutArgsError() { + Exception error = null; + try { + this.startSyncNonblockingServer(this.port); + this.syncClientWithoutArgs(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withoutArgs", 1); + } + + @Test + public void syncClientAsyncHsHaServerWithoutArgsError() { + Exception error = null; + try { + this.startAsyncHsHaServer(this.port); + this.syncClientWithoutArgs(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withoutArgs", 1); + } + + @Test + public void syncClientSyncHsHaServerWithoutArgsError() { + Exception error = null; + try { + this.startSyncHsHaServer(this.port); + this.syncClientWithoutArgs(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withoutArgs", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithoutArgs() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + this.nonBlockClientWithoutArgs(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithoutArgsMuti() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithoutArgs(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithoutArgs() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + this.nonBlockClientWithoutArgs(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithoutArgsMuti() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithoutArgs(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", threadCount); + } + + public void syncClientWithoutArgs(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.withoutArgs()); + Assertions.assertThat(response).isEqualTo("no args"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncClientMultiWithoutArgs(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + String response = this.testing().runWithSpan("parent", () -> client.withoutArgs()); + Assertions.assertThat(response).isEqualTo("no args"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientWithoutArgs(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.withoutArgs_call s) { + try { + String result = s.getResult(); + Assertions.assertThat(result).isEqualTo("no args"); + } catch (TException e) { + throw new VerifyException(e); + } + } + + @Override + public void onError(Exception e) { + Assertions.assertThat(e.getCause().getMessage()) + .isEqualTo("Read call frame size failed"); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.withoutArgs(callback)); + } + + public void syncFramedClientWithoutArgs(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.withoutArgs()); + Assertions.assertThat(response).isEqualTo("no args"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFramedClientMultiWithoutArgs(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + String response = this.testing().runWithSpan("parent", () -> client.withoutArgs()); + Assertions.assertThat(response).isEqualTo("no args"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientWithoutArgs(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withoutArgs()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/server/ThriftServiceAsyncImpl.java b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/server/ThriftServiceAsyncImpl.java new file mode 100644 index 000000000000..450dd549d169 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/server/ThriftServiceAsyncImpl.java @@ -0,0 +1,75 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_2.server; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_9_2.thrift.Account; +import io.opentelemetry.instrumentation.thrift.v0_9_2.thrift.ThriftService; +import io.opentelemetry.instrumentation.thrift.v0_9_2.thrift.User; +import io.opentelemetry.instrumentation.thrift.v0_9_2.thrift.UserAccount; +import java.util.concurrent.TimeUnit; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused", "all"}) +public class ThriftServiceAsyncImpl implements ThriftService.AsyncIface { + public ThriftServiceAsyncImpl() {} + + @Override + public void sayHello(String zone, String name, AsyncMethodCallback resultHandler) + throws TException { + resultHandler.onComplete("Hello " + zone + "s' " + name); + } + + @Override + public void withDelay(int delay, AsyncMethodCallback resultHandler) throws TException { + try { + TimeUnit.SECONDS.sleep(delay); + } catch (InterruptedException var4) { + InterruptedException e = var4; + throw new VerifyException(e); + } + + resultHandler.onComplete("delay " + delay); + } + + @Override + public void withoutArgs(AsyncMethodCallback resultHandler) throws TException { + resultHandler.onComplete("no args"); + } + + @Override + public void withError(AsyncMethodCallback resultHandler) throws TException { + throw new VerifyException("fail"); + } + + @Override + public void withCollisioin(String input, AsyncMethodCallback resultHandler) throws TException { + resultHandler.onComplete(input); + } + + @Override + public void noReturn(int delay, AsyncMethodCallback resultHandler) throws TException { + resultHandler.onComplete(null); + } + + @Override + public void oneWayHasArgs(int delay, AsyncMethodCallback resultHandler) throws TException {} + + @Override + public void oneWay(AsyncMethodCallback resultHandler) throws TException {} + + @Override + public void oneWayWithError(AsyncMethodCallback resultHandler) throws TException { + throw new VerifyException("fail"); + } + + @Override + public void data(User user, Account account, AsyncMethodCallback resultHandler) + throws TException { + resultHandler.onComplete(new UserAccount(user, account)); + } +} diff --git a/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/server/ThriftServiceImpl.java b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/server/ThriftServiceImpl.java new file mode 100644 index 000000000000..0c56ddd48901 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/server/ThriftServiceImpl.java @@ -0,0 +1,71 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_2.server; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_9_2.thrift.Account; +import io.opentelemetry.instrumentation.thrift.v0_9_2.thrift.ThriftService; +import io.opentelemetry.instrumentation.thrift.v0_9_2.thrift.User; +import io.opentelemetry.instrumentation.thrift.v0_9_2.thrift.UserAccount; +import java.util.concurrent.TimeUnit; +import org.apache.thrift.TException; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused", "all"}) +public class ThriftServiceImpl implements ThriftService.Iface { + + public ThriftServiceImpl() {} + + @Override + public String sayHello(String zone, String name) { + return "Hello " + zone + "s' " + name; + } + + @Override + public String withDelay(int delay) { + try { + TimeUnit.SECONDS.sleep((long) delay); + } catch (InterruptedException var3) { + InterruptedException e = var3; + throw new VerifyException(e); + } + + return "delay " + delay; + } + + @Override + public String withoutArgs() { + return "no args"; + } + + @Override + public String withError() { + throw new VerifyException("fail"); + } + + @Override + public String withCollisioin(String input) { + return input; + } + + @Override + public void noReturn(int delay) throws TException {} + + @Override + public void oneWayHasArgs(int delay) throws TException {} + + @Override + public void oneWay() {} + + @Override + public void oneWayWithError() { + throw new VerifyException("fail"); + } + + @Override + public UserAccount data(User user, Account account) { + return new UserAccount(user, account); + } +} diff --git a/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/thrift/Account.java b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/thrift/Account.java new file mode 100644 index 000000000000..e9c602e8e6e5 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/thrift/Account.java @@ -0,0 +1,492 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_2.thrift; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "all"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2025-2-27") +public class Account + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("Account"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField CARD_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "cardId", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new AccountStandardSchemeFactory()); + schemes.put(TupleScheme.class, new AccountTupleSchemeFactory()); + } + + public String zone; // required + public String cardId; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + CARD_ID((short) 2, "cardId"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // CARD_ID + return CARD_ID; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.CARD_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "cardId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Account.class, metaDataMap); + } + + public Account() {} + + public Account(String zone, String cardId) { + this(); + this.zone = zone; + this.cardId = cardId; + } + + /** Performs a deep copy on other. */ + public Account(Account other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetCardId()) { + this.cardId = other.cardId; + } + } + + public Account deepCopy() { + return new Account(this); + } + + @Override + public void clear() { + this.zone = null; + this.cardId = null; + } + + public String getZone() { + return this.zone; + } + + public Account setZone(String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + public String getCardId() { + return this.cardId; + } + + public Account setCardId(String cardId) { + this.cardId = cardId; + return this; + } + + public void unsetCardId() { + this.cardId = null; + } + + /** Returns true if field cardId is set (has been assigned a value) and false otherwise */ + public boolean isSetCardId() { + return this.cardId != null; + } + + public void setCardIdIsSet(boolean value) { + if (!value) { + this.cardId = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((String) value); + } + break; + + case CARD_ID: + if (value == null) { + unsetCardId(); + } else { + setCardId((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case CARD_ID: + return getCardId(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case CARD_ID: + return isSetCardId(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof Account) return this.equals((Account) that); + return false; + } + + public boolean equals(Account that) { + if (that == null) return false; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_cardId = true && this.isSetCardId(); + boolean that_present_cardId = true && that.isSetCardId(); + if (this_present_cardId || that_present_cardId) { + if (!(this_present_cardId && that_present_cardId)) return false; + if (!this.cardId.equals(that.cardId)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_zone = true && (isSetZone()); + list.add(present_zone); + if (present_zone) list.add(zone); + + boolean present_cardId = true && (isSetCardId()); + list.add(present_cardId); + if (present_cardId) list.add(cardId); + + return list.hashCode(); + } + + @Override + public int compareTo(Account other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetZone()).compareTo(other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetCardId()).compareTo(other.isSetCardId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCardId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cardId, other.cardId); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("Account("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("cardId:"); + if (this.cardId == null) { + sb.append("null"); + } else { + sb.append(this.cardId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (zone == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'zone' was not present! Struct: " + toString()); + } + if (cardId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'cardId' was not present! Struct: " + toString()); + } + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class AccountStandardSchemeFactory implements SchemeFactory { + public AccountStandardScheme getScheme() { + return new AccountStandardScheme(); + } + } + + private static class AccountStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // CARD_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, Account struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.cardId != null) { + oprot.writeFieldBegin(CARD_ID_FIELD_DESC); + oprot.writeString(struct.cardId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class AccountTupleSchemeFactory implements SchemeFactory { + public AccountTupleScheme getScheme() { + return new AccountTupleScheme(); + } + } + + private static class AccountTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeString(struct.zone); + oprot.writeString(struct.cardId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/thrift/ThriftService.java b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/thrift/ThriftService.java new file mode 100644 index 000000000000..02003fc2bf95 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/thrift/ThriftService.java @@ -0,0 +1,7532 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_2.thrift; + +import java.util.ArrayList; +import java.util.BitSet; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "all"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2025-2-27") +public class ThriftService { + + public interface Iface { + + public String sayHello(String zone, String name) throws TException; + + public String withDelay(int delay) throws TException; + + public String withoutArgs() throws TException; + + public String withError() throws TException; + + public String withCollisioin(String input) throws TException; + + public void noReturn(int delay) throws TException; + + public void oneWayHasArgs(int delay) throws TException; + + public void oneWay() throws TException; + + public void oneWayWithError() throws TException; + + public UserAccount data(User user, Account account) throws TException; + } + + public interface AsyncIface { + + public void sayHello(String zone, String name, AsyncMethodCallback resultHandler) + throws TException; + + public void withDelay(int delay, AsyncMethodCallback resultHandler) throws TException; + + public void withoutArgs(AsyncMethodCallback resultHandler) throws TException; + + public void withError(AsyncMethodCallback resultHandler) throws TException; + + public void withCollisioin(String input, AsyncMethodCallback resultHandler) throws TException; + + public void noReturn(int delay, AsyncMethodCallback resultHandler) throws TException; + + public void oneWayHasArgs(int delay, AsyncMethodCallback resultHandler) throws TException; + + public void oneWay(AsyncMethodCallback resultHandler) throws TException; + + public void oneWayWithError(AsyncMethodCallback resultHandler) throws TException; + + public void data(User user, Account account, AsyncMethodCallback resultHandler) + throws TException; + } + + public static class Client extends org.apache.thrift.TServiceClient implements Iface { + public static class Factory implements org.apache.thrift.TServiceClientFactory { + public Factory() {} + + public Client getClient(org.apache.thrift.protocol.TProtocol prot) { + return new Client(prot); + } + + public Client getClient( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + return new Client(iprot, oprot); + } + } + + public Client(org.apache.thrift.protocol.TProtocol prot) { + super(prot, prot); + } + + public Client( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + super(iprot, oprot); + } + + public String sayHello(String zone, String name) throws TException { + send_sayHello(zone, name); + return recv_sayHello(); + } + + public void send_sayHello(String zone, String name) throws TException { + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + sendBase("sayHello", args); + } + + public String recv_sayHello() throws TException { + sayHello_result result = new sayHello_result(); + receiveBase(result, "sayHello"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "sayHello failed: unknown result"); + } + + public String withDelay(int delay) throws TException { + send_withDelay(delay); + return recv_withDelay(); + } + + public void send_withDelay(int delay) throws TException { + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + sendBase("withDelay", args); + } + + public String recv_withDelay() throws TException { + withDelay_result result = new withDelay_result(); + receiveBase(result, "withDelay"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withDelay failed: unknown result"); + } + + public String withoutArgs() throws TException { + send_withoutArgs(); + return recv_withoutArgs(); + } + + public void send_withoutArgs() throws TException { + withoutArgs_args args = new withoutArgs_args(); + sendBase("withoutArgs", args); + } + + public String recv_withoutArgs() throws TException { + withoutArgs_result result = new withoutArgs_result(); + receiveBase(result, "withoutArgs"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withoutArgs failed: unknown result"); + } + + public String withError() throws TException { + send_withError(); + return recv_withError(); + } + + public void send_withError() throws TException { + withError_args args = new withError_args(); + sendBase("withError", args); + } + + public String recv_withError() throws TException { + withError_result result = new withError_result(); + receiveBase(result, "withError"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withError failed: unknown result"); + } + + public String withCollisioin(String input) throws TException { + send_withCollisioin(input); + return recv_withCollisioin(); + } + + public void send_withCollisioin(String input) throws TException { + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + sendBase("withCollisioin", args); + } + + public String recv_withCollisioin() throws TException { + withCollisioin_result result = new withCollisioin_result(); + receiveBase(result, "withCollisioin"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withCollisioin failed: unknown result"); + } + + public void noReturn(int delay) throws TException { + send_noReturn(delay); + recv_noReturn(); + } + + public void send_noReturn(int delay) throws TException { + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + sendBase("noReturn", args); + } + + public void recv_noReturn() throws TException { + noReturn_result result = new noReturn_result(); + receiveBase(result, "noReturn"); + return; + } + + public void oneWayHasArgs(int delay) throws TException { + send_oneWayHasArgs(delay); + } + + public void send_oneWayHasArgs(int delay) throws TException { + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + sendBase("oneWayHasArgs", args); + } + + public void oneWay() throws TException { + send_oneWay(); + } + + public void send_oneWay() throws TException { + oneWay_args args = new oneWay_args(); + sendBase("oneWay", args); + } + + public void oneWayWithError() throws TException { + send_oneWayWithError(); + } + + public void send_oneWayWithError() throws TException { + oneWayWithError_args args = new oneWayWithError_args(); + sendBase("oneWayWithError", args); + } + + public UserAccount data(User user, Account account) throws TException { + send_data(user, account); + return recv_data(); + } + + public void send_data(User user, Account account) throws TException { + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + sendBase("data", args); + } + + public UserAccount recv_data() throws TException { + data_result result = new data_result(); + receiveBase(result, "data"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, "data failed: unknown result"); + } + } + + public static class AsyncClient extends org.apache.thrift.async.TAsyncClient + implements AsyncIface { + public static class Factory + implements org.apache.thrift.async.TAsyncClientFactory { + private org.apache.thrift.async.TAsyncClientManager clientManager; + private org.apache.thrift.protocol.TProtocolFactory protocolFactory; + + public Factory( + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.protocol.TProtocolFactory protocolFactory) { + this.clientManager = clientManager; + this.protocolFactory = protocolFactory; + } + + public AsyncClient getAsyncClient( + org.apache.thrift.transport.TNonblockingTransport transport) { + return new AsyncClient(protocolFactory, clientManager, transport); + } + } + + public AsyncClient( + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.transport.TNonblockingTransport transport) { + super(protocolFactory, clientManager, transport); + } + + public void sayHello(String zone, String name, AsyncMethodCallback resultHandler) + throws TException { + checkReady(); + sayHello_call method_call = + new sayHello_call(zone, name, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class sayHello_call extends org.apache.thrift.async.TAsyncMethodCall { + private String zone; + private String name; + + public sayHello_call( + String zone, + String name, + AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + this.zone = zone; + this.name = name; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "sayHello", org.apache.thrift.protocol.TMessageType.CALL, 0)); + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_sayHello(); + } + } + + public void withDelay(int delay, AsyncMethodCallback resultHandler) throws TException { + checkReady(); + withDelay_call method_call = + new withDelay_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withDelay_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public withDelay_call( + int delay, + AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withDelay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withDelay(); + } + } + + public void withoutArgs(AsyncMethodCallback resultHandler) throws TException { + checkReady(); + withoutArgs_call method_call = + new withoutArgs_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withoutArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + public withoutArgs_call( + AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withoutArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withoutArgs_args args = new withoutArgs_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withoutArgs(); + } + } + + public void withError(AsyncMethodCallback resultHandler) throws TException { + checkReady(); + withError_call method_call = + new withError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withError_call extends org.apache.thrift.async.TAsyncMethodCall { + public withError_call( + AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withError_args args = new withError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withError(); + } + } + + public void withCollisioin(String input, AsyncMethodCallback resultHandler) throws TException { + checkReady(); + withCollisioin_call method_call = + new withCollisioin_call(input, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withCollisioin_call extends org.apache.thrift.async.TAsyncMethodCall { + private String input; + + public withCollisioin_call( + String input, + AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + this.input = input; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withCollisioin", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withCollisioin(); + } + } + + public void noReturn(int delay, AsyncMethodCallback resultHandler) throws TException { + checkReady(); + noReturn_call method_call = + new noReturn_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class noReturn_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public noReturn_call( + int delay, + AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "noReturn", org.apache.thrift.protocol.TMessageType.CALL, 0)); + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + (new Client(prot)).recv_noReturn(); + } + } + + public void oneWayHasArgs(int delay, AsyncMethodCallback resultHandler) throws TException { + checkReady(); + oneWayHasArgs_call method_call = + new oneWayHasArgs_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayHasArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public oneWayHasArgs_call( + int delay, + AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, true); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayHasArgs", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void oneWay(AsyncMethodCallback resultHandler) throws TException { + checkReady(); + oneWay_call method_call = + new oneWay_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWay_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWay_call( + AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWay", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWay_args args = new oneWay_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void oneWayWithError(AsyncMethodCallback resultHandler) throws TException { + checkReady(); + oneWayWithError_call method_call = + new oneWayWithError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayWithError_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWayWithError_call( + AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayWithError", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayWithError_args args = new oneWayWithError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void data(User user, Account account, AsyncMethodCallback resultHandler) + throws TException { + checkReady(); + data_call method_call = + new data_call(user, account, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class data_call extends org.apache.thrift.async.TAsyncMethodCall { + private User user; + private Account account; + + public data_call( + User user, + Account account, + AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + this.user = user; + this.account = account; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "data", org.apache.thrift.protocol.TMessageType.CALL, 0)); + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + args.write(prot); + prot.writeMessageEnd(); + } + + public UserAccount getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_data(); + } + } + } + + public static class Processor extends org.apache.thrift.TBaseProcessor + implements org.apache.thrift.TProcessor { + private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); + + public Processor(I iface) { + super( + iface, + getProcessMap( + new HashMap< + String, + org.apache.thrift.ProcessFunction>())); + } + + protected Processor( + I iface, + Map> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + Map> + getProcessMap( + Map> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.ProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + protected boolean isOneway() { + return false; + } + + public sayHello_result getResult(I iface, sayHello_args args) throws TException { + sayHello_result result = new sayHello_result(); + result.success = iface.sayHello(args.zone, args.name); + return result; + } + } + + public static class withDelay + extends org.apache.thrift.ProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + protected boolean isOneway() { + return false; + } + + public withDelay_result getResult(I iface, withDelay_args args) throws TException { + withDelay_result result = new withDelay_result(); + result.success = iface.withDelay(args.delay); + return result; + } + } + + public static class withoutArgs + extends org.apache.thrift.ProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + protected boolean isOneway() { + return false; + } + + public withoutArgs_result getResult(I iface, withoutArgs_args args) throws TException { + withoutArgs_result result = new withoutArgs_result(); + result.success = iface.withoutArgs(); + return result; + } + } + + public static class withError + extends org.apache.thrift.ProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + protected boolean isOneway() { + return false; + } + + public withError_result getResult(I iface, withError_args args) throws TException { + withError_result result = new withError_result(); + result.success = iface.withError(); + return result; + } + } + + public static class withCollisioin + extends org.apache.thrift.ProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + protected boolean isOneway() { + return false; + } + + public withCollisioin_result getResult(I iface, withCollisioin_args args) throws TException { + withCollisioin_result result = new withCollisioin_result(); + result.success = iface.withCollisioin(args.input); + return result; + } + } + + public static class noReturn + extends org.apache.thrift.ProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + protected boolean isOneway() { + return false; + } + + public noReturn_result getResult(I iface, noReturn_args args) throws TException { + noReturn_result result = new noReturn_result(); + iface.noReturn(args.delay); + return result; + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.ProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + protected boolean isOneway() { + return true; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayHasArgs_args args) throws TException { + iface.oneWayHasArgs(args.delay); + return null; + } + } + + public static class oneWay + extends org.apache.thrift.ProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + protected boolean isOneway() { + return true; + } + + public org.apache.thrift.TBase getResult(I iface, oneWay_args args) throws TException { + iface.oneWay(); + return null; + } + } + + public static class oneWayWithError + extends org.apache.thrift.ProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + protected boolean isOneway() { + return true; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayWithError_args args) + throws TException { + iface.oneWayWithError(); + return null; + } + } + + public static class data + extends org.apache.thrift.ProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + protected boolean isOneway() { + return false; + } + + public data_result getResult(I iface, data_args args) throws TException { + data_result result = new data_result(); + result.success = iface.data(args.user, args.account); + return result; + } + } + } + + public static class AsyncProcessor + extends org.apache.thrift.TBaseAsyncProcessor { + private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); + + public AsyncProcessor(I iface) { + super( + iface, + getProcessMap( + new HashMap< + String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>>())); + } + + protected AsyncProcessor( + I iface, + Map> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + Map> + getProcessMap( + Map< + String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.AsyncProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(String o) { + sayHello_result result = new sayHello_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + sayHello_result result = new sayHello_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, sayHello_args args, AsyncMethodCallback resultHandler) + throws TException { + iface.sayHello(args.zone, args.name, resultHandler); + } + } + + public static class withDelay + extends org.apache.thrift.AsyncProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(String o) { + withDelay_result result = new withDelay_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + withDelay_result result = new withDelay_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, withDelay_args args, AsyncMethodCallback resultHandler) + throws TException { + iface.withDelay(args.delay, resultHandler); + } + } + + public static class withoutArgs + extends org.apache.thrift.AsyncProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(String o) { + withoutArgs_result result = new withoutArgs_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + withoutArgs_result result = new withoutArgs_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, withoutArgs_args args, AsyncMethodCallback resultHandler) + throws TException { + iface.withoutArgs(resultHandler); + } + } + + public static class withError + extends org.apache.thrift.AsyncProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(String o) { + withError_result result = new withError_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + withError_result result = new withError_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, withError_args args, AsyncMethodCallback resultHandler) + throws TException { + iface.withError(resultHandler); + } + } + + public static class withCollisioin + extends org.apache.thrift.AsyncProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(String o) { + withCollisioin_result result = new withCollisioin_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + withCollisioin_result result = new withCollisioin_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, withCollisioin_args args, AsyncMethodCallback resultHandler) + throws TException { + iface.withCollisioin(args.input, resultHandler); + } + } + + public static class noReturn + extends org.apache.thrift.AsyncProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Void o) { + noReturn_result result = new noReturn_result(); + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + noReturn_result result = new noReturn_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, noReturn_args args, AsyncMethodCallback resultHandler) + throws TException { + iface.noReturn(args.delay, resultHandler); + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.AsyncProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(Exception e) {} + }; + } + + protected boolean isOneway() { + return true; + } + + public void start(I iface, oneWayHasArgs_args args, AsyncMethodCallback resultHandler) + throws TException { + iface.oneWayHasArgs(args.delay, resultHandler); + } + } + + public static class oneWay + extends org.apache.thrift.AsyncProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(Exception e) {} + }; + } + + protected boolean isOneway() { + return true; + } + + public void start(I iface, oneWay_args args, AsyncMethodCallback resultHandler) + throws TException { + iface.oneWay(resultHandler); + } + } + + public static class oneWayWithError + extends org.apache.thrift.AsyncProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(Exception e) {} + }; + } + + protected boolean isOneway() { + return true; + } + + public void start(I iface, oneWayWithError_args args, AsyncMethodCallback resultHandler) + throws TException { + iface.oneWayWithError(resultHandler); + } + } + + public static class data + extends org.apache.thrift.AsyncProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(UserAccount o) { + data_result result = new data_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + data_result result = new data_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, data_args args, AsyncMethodCallback resultHandler) + throws TException { + iface.data(args.user, args.account, resultHandler); + } + } + } + + public static class sayHello_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_args"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new sayHello_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new sayHello_argsTupleSchemeFactory()); + } + + public String zone; // required + public String name; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + NAME((short) 2, "name"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // NAME + return NAME; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_args.class, metaDataMap); + } + + public sayHello_args() {} + + public sayHello_args(String zone, String name) { + this(); + this.zone = zone; + this.name = name; + } + + /** Performs a deep copy on other. */ + public sayHello_args(sayHello_args other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetName()) { + this.name = other.name; + } + } + + public sayHello_args deepCopy() { + return new sayHello_args(this); + } + + @Override + public void clear() { + this.zone = null; + this.name = null; + } + + public String getZone() { + return this.zone; + } + + public sayHello_args setZone(String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + public String getName() { + return this.name; + } + + public sayHello_args setName(String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((String) value); + } + break; + + case NAME: + if (value == null) { + unsetName(); + } else { + setName((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case NAME: + return getName(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case NAME: + return isSetName(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof sayHello_args) return this.equals((sayHello_args) that); + return false; + } + + public boolean equals(sayHello_args that) { + if (that == null) return false; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_zone = true && (isSetZone()); + list.add(present_zone); + if (present_zone) list.add(zone); + + boolean present_name = true && (isSetName()); + list.add(present_name); + if (present_name) list.add(name); + + return list.hashCode(); + } + + @Override + public int compareTo(sayHello_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetZone()).compareTo(other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("sayHello_args("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_argsStandardSchemeFactory implements SchemeFactory { + public sayHello_argsStandardScheme getScheme() { + return new sayHello_argsStandardScheme(); + } + } + + private static class sayHello_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_argsTupleSchemeFactory implements SchemeFactory { + public sayHello_argsTupleScheme getScheme() { + return new sayHello_argsTupleScheme(); + } + } + + private static class sayHello_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetZone()) { + optionals.set(0); + } + if (struct.isSetName()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetZone()) { + oprot.writeString(struct.zone); + } + if (struct.isSetName()) { + oprot.writeString(struct.name); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } + if (incoming.get(1)) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } + } + } + } + + public static class sayHello_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new sayHello_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new sayHello_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_result.class, metaDataMap); + } + + public sayHello_result() {} + + public sayHello_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public sayHello_result(sayHello_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public sayHello_result deepCopy() { + return new sayHello_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public sayHello_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof sayHello_result) return this.equals((sayHello_result) that); + return false; + } + + public boolean equals(sayHello_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(sayHello_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("sayHello_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_resultStandardSchemeFactory implements SchemeFactory { + public sayHello_resultStandardScheme getScheme() { + return new sayHello_resultStandardScheme(); + } + } + + private static class sayHello_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_resultTupleSchemeFactory implements SchemeFactory { + public sayHello_resultTupleScheme getScheme() { + return new sayHello_resultTupleScheme(); + } + } + + private static class sayHello_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withDelay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withDelay_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withDelay_argsTupleSchemeFactory()); + } + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_args.class, metaDataMap); + } + + public withDelay_args() {} + + public withDelay_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public withDelay_args(withDelay_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public withDelay_args deepCopy() { + return new withDelay_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public withDelay_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return Integer.valueOf(getDelay()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withDelay_args) return this.equals((withDelay_args) that); + return false; + } + + public boolean equals(withDelay_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_delay = true; + list.add(present_delay); + if (present_delay) list.add(delay); + + return list.hashCode(); + } + + @Override + public int compareTo(withDelay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withDelay_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_argsStandardSchemeFactory implements SchemeFactory { + public withDelay_argsStandardScheme getScheme() { + return new withDelay_argsStandardScheme(); + } + } + + private static class withDelay_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_argsTupleSchemeFactory implements SchemeFactory { + public withDelay_argsTupleScheme getScheme() { + return new withDelay_argsTupleScheme(); + } + } + + private static class withDelay_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + } + + public static class withDelay_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withDelay_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withDelay_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_result.class, metaDataMap); + } + + public withDelay_result() {} + + public withDelay_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withDelay_result(withDelay_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withDelay_result deepCopy() { + return new withDelay_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withDelay_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withDelay_result) return this.equals((withDelay_result) that); + return false; + } + + public boolean equals(withDelay_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(withDelay_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withDelay_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_resultStandardSchemeFactory implements SchemeFactory { + public withDelay_resultStandardScheme getScheme() { + return new withDelay_resultStandardScheme(); + } + } + + private static class withDelay_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_resultTupleSchemeFactory implements SchemeFactory { + public withDelay_resultTupleScheme getScheme() { + return new withDelay_resultTupleScheme(); + } + } + + private static class withDelay_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withoutArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withoutArgs_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withoutArgs_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_args.class, metaDataMap); + } + + public withoutArgs_args() {} + + /** Performs a deep copy on other. */ + public withoutArgs_args(withoutArgs_args other) {} + + public withoutArgs_args deepCopy() { + return new withoutArgs_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withoutArgs_args) return this.equals((withoutArgs_args) that); + return false; + } + + public boolean equals(withoutArgs_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + return list.hashCode(); + } + + @Override + public int compareTo(withoutArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withoutArgs_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_argsStandardSchemeFactory implements SchemeFactory { + public withoutArgs_argsStandardScheme getScheme() { + return new withoutArgs_argsStandardScheme(); + } + } + + private static class withoutArgs_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_argsTupleSchemeFactory implements SchemeFactory { + public withoutArgs_argsTupleScheme getScheme() { + return new withoutArgs_argsTupleScheme(); + } + } + + private static class withoutArgs_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class withoutArgs_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withoutArgs_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withoutArgs_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_result.class, metaDataMap); + } + + public withoutArgs_result() {} + + public withoutArgs_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withoutArgs_result(withoutArgs_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withoutArgs_result deepCopy() { + return new withoutArgs_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withoutArgs_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withoutArgs_result) return this.equals((withoutArgs_result) that); + return false; + } + + public boolean equals(withoutArgs_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(withoutArgs_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withoutArgs_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_resultStandardSchemeFactory implements SchemeFactory { + public withoutArgs_resultStandardScheme getScheme() { + return new withoutArgs_resultStandardScheme(); + } + } + + private static class withoutArgs_resultStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_resultTupleSchemeFactory implements SchemeFactory { + public withoutArgs_resultTupleScheme getScheme() { + return new withoutArgs_resultTupleScheme(); + } + } + + private static class withoutArgs_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withError_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withError_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_args.class, metaDataMap); + } + + public withError_args() {} + + /** Performs a deep copy on other. */ + public withError_args(withError_args other) {} + + public withError_args deepCopy() { + return new withError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withError_args) return this.equals((withError_args) that); + return false; + } + + public boolean equals(withError_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + return list.hashCode(); + } + + @Override + public int compareTo(withError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_argsStandardSchemeFactory implements SchemeFactory { + public withError_argsStandardScheme getScheme() { + return new withError_argsStandardScheme(); + } + } + + private static class withError_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_argsTupleSchemeFactory implements SchemeFactory { + public withError_argsTupleScheme getScheme() { + return new withError_argsTupleScheme(); + } + } + + private static class withError_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class withError_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withError_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withError_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_result.class, metaDataMap); + } + + public withError_result() {} + + public withError_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withError_result(withError_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withError_result deepCopy() { + return new withError_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withError_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withError_result) return this.equals((withError_result) that); + return false; + } + + public boolean equals(withError_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(withError_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withError_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_resultStandardSchemeFactory implements SchemeFactory { + public withError_resultStandardScheme getScheme() { + return new withError_resultStandardScheme(); + } + } + + private static class withError_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_resultTupleSchemeFactory implements SchemeFactory { + public withError_resultTupleScheme getScheme() { + return new withError_resultTupleScheme(); + } + } + + private static class withError_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withCollisioin_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_args"); + + private static final org.apache.thrift.protocol.TField INPUT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "input", org.apache.thrift.protocol.TType.STRING, (short) 3333); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withCollisioin_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withCollisioin_argsTupleSchemeFactory()); + } + + public String input; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + INPUT((short) 3333, "input"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 3333: // INPUT + return INPUT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.INPUT, + new org.apache.thrift.meta_data.FieldMetaData( + "input", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_args.class, metaDataMap); + } + + public withCollisioin_args() {} + + public withCollisioin_args(String input) { + this(); + this.input = input; + } + + /** Performs a deep copy on other. */ + public withCollisioin_args(withCollisioin_args other) { + if (other.isSetInput()) { + this.input = other.input; + } + } + + public withCollisioin_args deepCopy() { + return new withCollisioin_args(this); + } + + @Override + public void clear() { + this.input = null; + } + + public String getInput() { + return this.input; + } + + public withCollisioin_args setInput(String input) { + this.input = input; + return this; + } + + public void unsetInput() { + this.input = null; + } + + /** Returns true if field input is set (has been assigned a value) and false otherwise */ + public boolean isSetInput() { + return this.input != null; + } + + public void setInputIsSet(boolean value) { + if (!value) { + this.input = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case INPUT: + if (value == null) { + unsetInput(); + } else { + setInput((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case INPUT: + return getInput(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case INPUT: + return isSetInput(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withCollisioin_args) return this.equals((withCollisioin_args) that); + return false; + } + + public boolean equals(withCollisioin_args that) { + if (that == null) return false; + + boolean this_present_input = true && this.isSetInput(); + boolean that_present_input = true && that.isSetInput(); + if (this_present_input || that_present_input) { + if (!(this_present_input && that_present_input)) return false; + if (!this.input.equals(that.input)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_input = true && (isSetInput()); + list.add(present_input); + if (present_input) list.add(input); + + return list.hashCode(); + } + + @Override + public int compareTo(withCollisioin_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetInput()).compareTo(other.isSetInput()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInput()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.input, other.input); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withCollisioin_args("); + boolean first = true; + + sb.append("input:"); + if (this.input == null) { + sb.append("null"); + } else { + sb.append(this.input); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_argsStandardSchemeFactory implements SchemeFactory { + public withCollisioin_argsStandardScheme getScheme() { + return new withCollisioin_argsStandardScheme(); + } + } + + private static class withCollisioin_argsStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 3333: // INPUT + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.input != null) { + oprot.writeFieldBegin(INPUT_FIELD_DESC); + oprot.writeString(struct.input); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_argsTupleSchemeFactory implements SchemeFactory { + public withCollisioin_argsTupleScheme getScheme() { + return new withCollisioin_argsTupleScheme(); + } + } + + private static class withCollisioin_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetInput()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetInput()) { + oprot.writeString(struct.input); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } + } + } + } + + public static class withCollisioin_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withCollisioin_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withCollisioin_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_result.class, metaDataMap); + } + + public withCollisioin_result() {} + + public withCollisioin_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withCollisioin_result(withCollisioin_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withCollisioin_result deepCopy() { + return new withCollisioin_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withCollisioin_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withCollisioin_result) return this.equals((withCollisioin_result) that); + return false; + } + + public boolean equals(withCollisioin_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(withCollisioin_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withCollisioin_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_resultStandardSchemeFactory implements SchemeFactory { + public withCollisioin_resultStandardScheme getScheme() { + return new withCollisioin_resultStandardScheme(); + } + } + + private static class withCollisioin_resultStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_resultTupleSchemeFactory implements SchemeFactory { + public withCollisioin_resultTupleScheme getScheme() { + return new withCollisioin_resultTupleScheme(); + } + } + + private static class withCollisioin_resultTupleScheme + extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class noReturn_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new noReturn_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new noReturn_argsTupleSchemeFactory()); + } + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_args.class, metaDataMap); + } + + public noReturn_args() {} + + public noReturn_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public noReturn_args(noReturn_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public noReturn_args deepCopy() { + return new noReturn_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public noReturn_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return Integer.valueOf(getDelay()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof noReturn_args) return this.equals((noReturn_args) that); + return false; + } + + public boolean equals(noReturn_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_delay = true; + list.add(present_delay); + if (present_delay) list.add(delay); + + return list.hashCode(); + } + + @Override + public int compareTo(noReturn_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("noReturn_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_argsStandardSchemeFactory implements SchemeFactory { + public noReturn_argsStandardScheme getScheme() { + return new noReturn_argsStandardScheme(); + } + } + + private static class noReturn_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_argsTupleSchemeFactory implements SchemeFactory { + public noReturn_argsTupleScheme getScheme() { + return new noReturn_argsTupleScheme(); + } + } + + private static class noReturn_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + } + + public static class noReturn_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_result"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new noReturn_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new noReturn_resultTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_result.class, metaDataMap); + } + + public noReturn_result() {} + + /** Performs a deep copy on other. */ + public noReturn_result(noReturn_result other) {} + + public noReturn_result deepCopy() { + return new noReturn_result(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof noReturn_result) return this.equals((noReturn_result) that); + return false; + } + + public boolean equals(noReturn_result that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + return list.hashCode(); + } + + @Override + public int compareTo(noReturn_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("noReturn_result("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_resultStandardSchemeFactory implements SchemeFactory { + public noReturn_resultStandardScheme getScheme() { + return new noReturn_resultStandardScheme(); + } + } + + private static class noReturn_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_resultTupleSchemeFactory implements SchemeFactory { + public noReturn_resultTupleScheme getScheme() { + return new noReturn_resultTupleScheme(); + } + } + + private static class noReturn_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class oneWayHasArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayHasArgs_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new oneWayHasArgs_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new oneWayHasArgs_argsTupleSchemeFactory()); + } + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayHasArgs_args.class, metaDataMap); + } + + public oneWayHasArgs_args() {} + + public oneWayHasArgs_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public oneWayHasArgs_args(oneWayHasArgs_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public oneWayHasArgs_args deepCopy() { + return new oneWayHasArgs_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public oneWayHasArgs_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return Integer.valueOf(getDelay()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWayHasArgs_args) return this.equals((oneWayHasArgs_args) that); + return false; + } + + public boolean equals(oneWayHasArgs_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_delay = true; + list.add(present_delay); + if (present_delay) list.add(delay); + + return list.hashCode(); + } + + @Override + public int compareTo(oneWayHasArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWayHasArgs_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayHasArgs_argsStandardSchemeFactory implements SchemeFactory { + public oneWayHasArgs_argsStandardScheme getScheme() { + return new oneWayHasArgs_argsStandardScheme(); + } + } + + private static class oneWayHasArgs_argsStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayHasArgs_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayHasArgs_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayHasArgs_argsTupleSchemeFactory implements SchemeFactory { + public oneWayHasArgs_argsTupleScheme getScheme() { + return new oneWayHasArgs_argsTupleScheme(); + } + } + + private static class oneWayHasArgs_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + } + + public static class oneWay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWay_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new oneWay_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new oneWay_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWay_args.class, metaDataMap); + } + + public oneWay_args() {} + + /** Performs a deep copy on other. */ + public oneWay_args(oneWay_args other) {} + + public oneWay_args deepCopy() { + return new oneWay_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWay_args) return this.equals((oneWay_args) that); + return false; + } + + public boolean equals(oneWay_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + return list.hashCode(); + } + + @Override + public int compareTo(oneWay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWay_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWay_argsStandardSchemeFactory implements SchemeFactory { + public oneWay_argsStandardScheme getScheme() { + return new oneWay_argsStandardScheme(); + } + } + + private static class oneWay_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWay_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWay_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWay_argsTupleSchemeFactory implements SchemeFactory { + public oneWay_argsTupleScheme getScheme() { + return new oneWay_argsTupleScheme(); + } + } + + private static class oneWay_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class oneWayWithError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayWithError_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new oneWayWithError_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new oneWayWithError_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayWithError_args.class, metaDataMap); + } + + public oneWayWithError_args() {} + + /** Performs a deep copy on other. */ + public oneWayWithError_args(oneWayWithError_args other) {} + + public oneWayWithError_args deepCopy() { + return new oneWayWithError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWayWithError_args) return this.equals((oneWayWithError_args) that); + return false; + } + + public boolean equals(oneWayWithError_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + return list.hashCode(); + } + + @Override + public int compareTo(oneWayWithError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWayWithError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayWithError_argsStandardSchemeFactory implements SchemeFactory { + public oneWayWithError_argsStandardScheme getScheme() { + return new oneWayWithError_argsStandardScheme(); + } + } + + private static class oneWayWithError_argsStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayWithError_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayWithError_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayWithError_argsTupleSchemeFactory implements SchemeFactory { + public oneWayWithError_argsTupleScheme getScheme() { + return new oneWayWithError_argsTupleScheme(); + } + } + + private static class oneWayWithError_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class data_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_args"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new data_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new data_argsTupleSchemeFactory()); + } + + public User user; // required + public Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(data_args.class, metaDataMap); + } + + public data_args() {} + + public data_args(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public data_args(data_args other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public data_args deepCopy() { + return new data_args(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + public User getUser() { + return this.user; + } + + public data_args setUser(User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + public Account getAccount() { + return this.account; + } + + public data_args setAccount(Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof data_args) return this.equals((data_args) that); + return false; + } + + public boolean equals(data_args that) { + if (that == null) return false; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_user = true && (isSetUser()); + list.add(present_user); + if (present_user) list.add(user); + + boolean present_account = true && (isSetAccount()); + list.add(present_account); + if (present_account) list.add(account); + + return list.hashCode(); + } + + @Override + public int compareTo(data_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetUser()).compareTo(other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAccount()).compareTo(other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("data_args("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_argsStandardSchemeFactory implements SchemeFactory { + public data_argsStandardScheme getScheme() { + return new data_argsStandardScheme(); + } + } + + private static class data_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_argsTupleSchemeFactory implements SchemeFactory { + public data_argsTupleScheme getScheme() { + return new data_argsTupleScheme(); + } + } + + private static class data_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetUser()) { + optionals.set(0); + } + if (struct.isSetAccount()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetUser()) { + struct.user.write(oprot); + } + if (struct.isSetAccount()) { + struct.account.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } + if (incoming.get(1)) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + } + } + + public static class data_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRUCT, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new data_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new data_resultTupleSchemeFactory()); + } + + public UserAccount success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, UserAccount.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + data_result.class, metaDataMap); + } + + public data_result() {} + + public data_result(UserAccount success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public data_result(data_result other) { + if (other.isSetSuccess()) { + this.success = new UserAccount(other.success); + } + } + + public data_result deepCopy() { + return new data_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public UserAccount getSuccess() { + return this.success; + } + + public data_result setSuccess(UserAccount success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((UserAccount) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof data_result) return this.equals((data_result) that); + return false; + } + + public boolean equals(data_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(data_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("data_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_resultStandardSchemeFactory implements SchemeFactory { + public data_resultStandardScheme getScheme() { + return new data_resultStandardScheme(); + } + } + + private static class data_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_resultTupleSchemeFactory implements SchemeFactory { + public data_resultTupleScheme getScheme() { + return new data_resultTupleScheme(); + } + } + + private static class data_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/thrift/User.java b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/thrift/User.java new file mode 100644 index 000000000000..05d0e787d56e --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/thrift/User.java @@ -0,0 +1,597 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_2.thrift; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "all"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2025-2-27") +public class User + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("User"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "userId", org.apache.thrift.protocol.TType.STRING, (short) 2); + private static final org.apache.thrift.protocol.TField AGE_FIELD_DESC = + new org.apache.thrift.protocol.TField("age", org.apache.thrift.protocol.TType.I32, (short) 3); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new UserStandardSchemeFactory()); + schemes.put(TupleScheme.class, new UserTupleSchemeFactory()); + } + + public String name; // required + public String userId; // required + public int age; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + NAME((short) 1, "name"), + USER_ID((short) 2, "userId"), + AGE((short) 3, "age"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // NAME + return NAME; + case 2: // USER_ID + return USER_ID; + case 3: // AGE + return AGE; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __AGE_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.USER_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "userId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.AGE, + new org.apache.thrift.meta_data.FieldMetaData( + "age", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(User.class, metaDataMap); + } + + public User() {} + + public User(String name, String userId, int age) { + this(); + this.name = name; + this.userId = userId; + this.age = age; + setAgeIsSet(true); + } + + /** Performs a deep copy on other. */ + public User(User other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetName()) { + this.name = other.name; + } + if (other.isSetUserId()) { + this.userId = other.userId; + } + this.age = other.age; + } + + public User deepCopy() { + return new User(this); + } + + @Override + public void clear() { + this.name = null; + this.userId = null; + setAgeIsSet(false); + this.age = 0; + } + + public String getName() { + return this.name; + } + + public User setName(String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public String getUserId() { + return this.userId; + } + + public User setUserId(String userId) { + this.userId = userId; + return this; + } + + public void unsetUserId() { + this.userId = null; + } + + /** Returns true if field userId is set (has been assigned a value) and false otherwise */ + public boolean isSetUserId() { + return this.userId != null; + } + + public void setUserIdIsSet(boolean value) { + if (!value) { + this.userId = null; + } + } + + public int getAge() { + return this.age; + } + + public User setAge(int age) { + this.age = age; + setAgeIsSet(true); + return this; + } + + public void unsetAge() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __AGE_ISSET_ID); + } + + /** Returns true if field age is set (has been assigned a value) and false otherwise */ + public boolean isSetAge() { + return EncodingUtils.testBit(__isset_bitfield, __AGE_ISSET_ID); + } + + public void setAgeIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __AGE_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case NAME: + if (value == null) { + unsetName(); + } else { + setName((String) value); + } + break; + + case USER_ID: + if (value == null) { + unsetUserId(); + } else { + setUserId((String) value); + } + break; + + case AGE: + if (value == null) { + unsetAge(); + } else { + setAge((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case NAME: + return getName(); + + case USER_ID: + return getUserId(); + + case AGE: + return Integer.valueOf(getAge()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case NAME: + return isSetName(); + case USER_ID: + return isSetUserId(); + case AGE: + return isSetAge(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof User) return this.equals((User) that); + return false; + } + + public boolean equals(User that) { + if (that == null) return false; + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + boolean this_present_userId = true && this.isSetUserId(); + boolean that_present_userId = true && that.isSetUserId(); + if (this_present_userId || that_present_userId) { + if (!(this_present_userId && that_present_userId)) return false; + if (!this.userId.equals(that.userId)) return false; + } + + boolean this_present_age = true; + boolean that_present_age = true; + if (this_present_age || that_present_age) { + if (!(this_present_age && that_present_age)) return false; + if (this.age != that.age) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_name = true && (isSetName()); + list.add(present_name); + if (present_name) list.add(name); + + boolean present_userId = true && (isSetUserId()); + list.add(present_userId); + if (present_userId) list.add(userId); + + boolean present_age = true; + list.add(present_age); + if (present_age) list.add(age); + + return list.hashCode(); + } + + @Override + public int compareTo(User other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetUserId()).compareTo(other.isSetUserId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAge()).compareTo(other.isSetAge()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAge()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.age, other.age); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("User("); + boolean first = true; + + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + if (!first) sb.append(", "); + sb.append("userId:"); + if (this.userId == null) { + sb.append("null"); + } else { + sb.append(this.userId); + } + first = false; + if (!first) sb.append(", "); + sb.append("age:"); + sb.append(this.age); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (name == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'name' was not present! Struct: " + toString()); + } + if (userId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'userId' was not present! Struct: " + toString()); + } + // alas, we cannot check 'age' because it's a primitive and you chose the non-beans generator. + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserStandardSchemeFactory implements SchemeFactory { + public UserStandardScheme getScheme() { + return new UserStandardScheme(); + } + } + + private static class UserStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // AGE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + if (!struct.isSetAge()) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'age' was not found in serialized data! Struct: " + toString()); + } + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, User struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + if (struct.userId != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userId); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(AGE_FIELD_DESC); + oprot.writeI32(struct.age); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserTupleSchemeFactory implements SchemeFactory { + public UserTupleScheme getScheme() { + return new UserTupleScheme(); + } + } + + private static class UserTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeString(struct.name); + oprot.writeString(struct.userId); + oprot.writeI32(struct.age); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.name = iprot.readString(); + struct.setNameIsSet(true); + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/thrift/UserAccount.java b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/thrift/UserAccount.java new file mode 100644 index 000000000000..ea9e387abf2f --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.2-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_2/thrift/UserAccount.java @@ -0,0 +1,502 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_2.thrift; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "all"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2025-2-27") +public class UserAccount + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("UserAccount"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new UserAccountStandardSchemeFactory()); + schemes.put(TupleScheme.class, new UserAccountTupleSchemeFactory()); + } + + public User user; // required + public Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserAccount.class, metaDataMap); + } + + public UserAccount() {} + + public UserAccount(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public UserAccount(UserAccount other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public UserAccount deepCopy() { + return new UserAccount(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + public User getUser() { + return this.user; + } + + public UserAccount setUser(User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + public Account getAccount() { + return this.account; + } + + public UserAccount setAccount(Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof UserAccount) return this.equals((UserAccount) that); + return false; + } + + public boolean equals(UserAccount that) { + if (that == null) return false; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_user = true && (isSetUser()); + list.add(present_user); + if (present_user) list.add(user); + + boolean present_account = true && (isSetAccount()); + list.add(present_account); + if (present_account) list.add(account); + + return list.hashCode(); + } + + @Override + public int compareTo(UserAccount other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetUser()).compareTo(other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAccount()).compareTo(other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("UserAccount("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (user == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'user' was not present! Struct: " + toString()); + } + if (account == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'account' was not present! Struct: " + toString()); + } + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserAccountStandardSchemeFactory implements SchemeFactory { + public UserAccountStandardScheme getScheme() { + return new UserAccountStandardScheme(); + } + } + + private static class UserAccountStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, UserAccount struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserAccountTupleSchemeFactory implements SchemeFactory { + public UserAccountTupleScheme getScheme() { + return new UserAccountTupleScheme(); + } + } + + private static class UserAccountTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + struct.user.write(oprot); + struct.account.write(oprot); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.3-testing/build.gradle.kts b/instrumentation/thrift/thrift-0.9.3-testing/build.gradle.kts new file mode 100644 index 000000000000..e26d2e4c838d --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.3-testing/build.gradle.kts @@ -0,0 +1,12 @@ +plugins { + id("otel.javaagent-testing") +} + +dependencies { + testImplementation("org.apache.thrift:libthrift:0.9.3") + testImplementation("javax.annotation:javax.annotation-api:1.3.2") + + implementation(project(":instrumentation:thrift:thrift-0.9.1:javaagent")) { + exclude("org.apache.thrift", "libthrift") + } +} diff --git a/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/NoReturnTest.java b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/NoReturnTest.java new file mode 100644 index 000000000000..fcd295da5f96 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/NoReturnTest.java @@ -0,0 +1,1128 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_3; + +import io.opentelemetry.instrumentation.thrift.v0_9_3.common.TMultiplexedProtocolFactory; +import io.opentelemetry.instrumentation.thrift.v0_9_3.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFastFramedTransport; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class NoReturnTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerNoReturn() throws TException { + this.startSyncSimpleServer(this.port); + this.syncClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncClientSyncSimpleServerNoReturnMuti() throws TException { + this.startSyncSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientNoReturn(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("noReturn", 5); + } + + @Test + public void syncClientSyncSimpleServerNoReturnParallel() throws TException, InterruptedException { + this.startSyncSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientNoReturn(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerNoReturnParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("noReturn", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerNoReturn() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientNoReturn(port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncClientSyncThreadPoolServerNoReturnMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientNoReturn(port); + } + this.waitAndAssertTracesClientSyncServerSync("noReturn", 5); + } + + @Test + public void syncClientSyncThreadPoolServerNoReturnParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientNoReturn(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerNoReturnParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("noReturn", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerNoReturn() throws TException { + this.startMultiSimpleServer(this.port); + this.syncClientMultiNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", "syncHelloWorld:noReturn", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerNoReturnMuti() throws TException { + this.startMultiSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiNoReturn(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("noReturn", "syncHelloWorld:noReturn", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerNoReturnParallel() + throws TException, InterruptedException { + this.startMultiSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiNoReturn(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerNoReturnParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "noReturn", "syncHelloWorld:noReturn", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerNoReturnError() { + Exception error = null; + try { + this.startSyncThreadedSelectorServer(this.port); + this.syncClientNoReturn(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("noReturn", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerNoReturnError() { + Exception error = null; + try { + this.startAsyncThreadedSelectorServer(this.port); + this.syncClientNoReturn(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("noReturn", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerNoReturn() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + this.syncFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFastFramedClientAsyncThreadedSelectorServerNoReturn() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + this.syncFastFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorFastServerNoReturn() throws TException { + this.startAsyncThreadedSelectorFastServer(this.port); + this.syncFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFastFramedClientAsyncThreadedSelectorFastServerNoReturn() throws TException { + this.startAsyncThreadedSelectorFastServer(this.port); + this.syncFastFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerNoReturnMuti() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientNoReturn(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerNoReturnParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientNoReturn(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerNoReturn() throws TException { + this.startMultiThreadedSelectorServer(this.port); + this.syncFramedClientMultiNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", "syncHelloWorld:noReturn", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerNoReturnMuti() throws TException { + this.startMultiThreadedSelectorServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiNoReturn(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("noReturn", "syncHelloWorld:noReturn", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerNoReturnParallel() + throws TException, InterruptedException { + this.startMultiThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiNoReturn(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "noReturn", "syncHelloWorld:noReturn", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerNoReturn() throws TException { + this.startSyncThreadedSelectorServer(this.port); + this.syncFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFastFramedClientSyncThreadedSelectorServerNoReturn() throws TException { + this.startSyncThreadedSelectorServer(this.port); + this.syncFastFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorFastServerNoReturn() throws TException { + this.startSyncThreadedSelectorFastServer(this.port); + this.syncFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFastFramedClientSyncThreadedSelectorFastServerNoReturn() throws TException { + this.startSyncThreadedSelectorFastServer(this.port); + this.syncFastFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerNoReturnMuti() throws TException { + this.startSyncThreadedSelectorServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncFramedClientNoReturn(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("noReturn", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerNoReturnParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientNoReturn(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("noReturn", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerNoReturn() throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + this.nonBlockClientNoReturn(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerNoReturnMuti() + throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + for (int i = 0; i < 5; ++i) { + this.nonBlockClientNoReturn(this.port); + } + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerNoReturnParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientNoReturn(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerNoReturn() throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + this.nonBlockClientNoReturn(this.port); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerNoReturnMuti() + throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + for (int i = 0; i < 5; ++i) { + this.nonBlockClientNoReturn(this.port); + } + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerNoReturnParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientNoReturn(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerNoReturn() throws TException { + this.startSyncNonblockingServer(this.port); + this.syncFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFastFramedClientSyncNonblockingServerNoReturn() throws TException { + this.startSyncNonblockingServer(this.port); + this.syncFastFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFramedClientSyncNonblockingFastServerNoReturn() throws TException { + this.startSyncNonblockingFastServer(this.port); + this.syncFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFastFramedClientSyncNonblockingFastServerNoReturn() throws TException { + this.startSyncNonblockingFastServer(this.port); + this.syncFastFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerNoReturnMuti() throws TException { + this.startSyncNonblockingServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncFramedClientNoReturn(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("noReturn", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerNoReturnParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientNoReturn(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("noReturn", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerNoReturn() throws TException { + this.startSyncHsHaServer(this.port); + this.syncFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFastFramedClientSyncHsHaServerNoReturn() throws TException { + this.startSyncHsHaServer(this.port); + this.syncFastFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFramedClientSyncHsHaFastServerNoReturn() throws TException { + this.startSyncHsHaFastServer(this.port); + this.syncFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFastFramedClientSyncHsHaFastServerNoReturn() throws TException { + this.startSyncHsHaFastServer(this.port); + this.syncFastFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerSync("noReturn", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerNoReturnMuti() throws TException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientNoReturn(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("noReturn", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerNoReturnParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientNoReturn(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("noReturn", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerNoReturn() throws TException { + this.startAsyncNonblockingServer(this.port); + this.syncFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFastFramedClientAsyncNonblockingServerNoReturn() throws TException { + this.startAsyncNonblockingServer(this.port); + this.syncFastFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerNoReturnMuti() throws TException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientNoReturn(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerNoReturnParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientNoReturn(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerNoReturn() throws TException { + this.startAsyncHsHaServer(this.port); + this.syncFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFastFramedClientAsyncHsHaServerNoReturn() throws TException { + this.startAsyncHsHaServer(this.port); + this.syncFastFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFramedClientAsyncHsHaFastServerNoReturn() throws TException { + this.startAsyncHsHaFastServer(this.port); + this.syncFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFastFramedClientAsyncHsHaFastServerNoReturn() throws TException { + this.startAsyncHsHaFastServer(this.port); + this.syncFastFramedClientNoReturn(this.port); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerNoReturnMuti() throws TException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientNoReturn(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("noReturn", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerNoReturnParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientNoReturn(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("noReturn", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerNoReturn() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + this.nonBlockClientNoReturn(this.port); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerNoReturnMuti() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientNoReturn(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerNoReturnParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientNoReturn(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerNoReturn() throws TException, IOException { + this.startSyncHsHaServer(this.port); + this.nonBlockClientNoReturn(this.port); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 1); + } + + @Test + public void nonBlockMultiClientSyncHsHaServerMultiNoReturn() throws TException, IOException { + this.startMultiSyncHsHaServer(this.port); + this.nonBlockClientMultiNoReturn(this.port); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", "syncHelloWorld:noReturn", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerNoReturnMuti() throws TException, IOException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientNoReturn(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("noReturn", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerNoReturnParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientNoReturn(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("noReturn", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerNoReturnError() { + Exception error = null; + try { + this.startAsyncNonblockingServer(this.port); + this.syncClientNoReturn(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("noReturn", 1); + } + + @Test + public void syncClientSyncNonblockingServerNoReturnError() { + Exception error = null; + try { + this.startSyncNonblockingServer(this.port); + this.syncClientNoReturn(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("noReturn", 1); + } + + @Test + public void syncClientAsyncHsHaServerNoReturnError() { + Exception error = null; + try { + this.startAsyncHsHaServer(this.port); + this.syncClientNoReturn(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("noReturn", 1); + } + + @Test + public void syncClientSyncHsHaServerNoReturnError() { + Exception error = null; + try { + this.startSyncHsHaServer(this.port); + this.syncClientNoReturn(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("noReturn", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerNoReturn() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + this.nonBlockClientNoReturn(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerNoReturnMuti() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientNoReturn(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerNoReturnParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientNoReturn(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerNoReturn() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + this.nonBlockClientNoReturn(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerNoReturnMuti() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientNoReturn(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerNoReturnParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientNoReturn(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerNoReturnParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("noReturn", threadCount); + } + + public void syncClientNoReturn(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.noReturn(1)); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncClientMultiNoReturn(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + this.testing().runWithSpan("parent", () -> client.noReturn(1)); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientNoReturn(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.noReturn_call s) {} + + @Override + public void onError(Exception e) { + Assertions.assertThat(e.getCause().getMessage()) + .isEqualTo("Read call frame size failed"); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.noReturn(1, callback)); + } + + public void nonBlockClientMultiNoReturn(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + TMultiplexedProtocolFactory multiplexedProtocolFactory = + new TMultiplexedProtocolFactory(protocolFactory, "syncHelloWorld"); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, multiplexedProtocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.noReturn_call s) {} + + @Override + public void onError(Exception e) { + Assertions.assertThat(e.getCause().getMessage()) + .isEqualTo("Read call frame size failed"); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.noReturn(1, callback)); + } + + public void syncFramedClientNoReturn(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.noReturn(1)); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFastFramedClientNoReturn(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFastFramedTransport framedTransport = new TFastFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.noReturn(1)); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFramedClientMultiNoReturn(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + this.testing().runWithSpan("parent", () -> client.noReturn(1)); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientNoReturn(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.noReturn(1)); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/OneWayErrorTest.java b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/OneWayErrorTest.java new file mode 100644 index 000000000000..48c658deb220 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/OneWayErrorTest.java @@ -0,0 +1,1030 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_3; + +import io.opentelemetry.instrumentation.thrift.v0_9_3.common.TMultiplexedProtocolFactory; +import io.opentelemetry.instrumentation.thrift.v0_9_3.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class OneWayErrorTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerOneWayWithError() throws TException { + this.startSyncSimpleServer(this.port); + this.syncClientOneWayWithError(this.port); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void syncClientSyncSimpleServerOneWayWithErrorMuti() throws TException { + this.startSyncSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientOneWayWithError(this.port); + } + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void syncClientSyncSimpleServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startSyncSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientOneWayWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerOneWayWithError() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientOneWayWithError(port); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void syncClientSyncThreadPoolServerOneWayWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientOneWayWithError(port); + } + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void syncClientSyncThreadPoolServerOneWayWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientOneWayWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerOneWayWithError() throws TException { + this.startMultiSimpleServer(this.port); + this.syncClientMultiOneWayWithError(this.port); + this.waitAndAssertTracesClientSyncServerSyncOnewayError( + "oneWayWithError", "syncHelloWorld:oneWayWithError", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerOneWayWithErrorMuti() throws TException { + this.startMultiSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiOneWayWithError(this.port); + } + this.waitAndAssertTracesClientSyncServerSyncOnewayError( + "oneWayWithError", "syncHelloWorld:oneWayWithError", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startMultiSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiOneWayWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOnewayError( + "oneWayWithError", "syncHelloWorld:oneWayWithError", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerOneWayWithErrorError() { + Exception error = null; + try { + this.startSyncThreadedSelectorServer(this.port); + this.syncClientOneWayWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWayWithError", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerOneWayWithErrorError() { + Exception error = null; + try { + this.startAsyncThreadedSelectorServer(this.port); + this.syncClientOneWayWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWayWithError", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerOneWayWithError() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + this.syncFramedClientOneWayWithError(this.port); + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerOneWayWithErrorMuti() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWayWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerOneWayWithError() throws TException { + this.startMultiThreadedSelectorServer(this.port); + this.syncFramedClientMultiOneWayWithError(this.port); + this.waitAndAssertTracesClientSyncServerSyncOnewayError( + "oneWayWithError", "syncHelloWorld:oneWayWithError", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerOneWayWithErrorMuti() + throws TException { + this.startMultiThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerSyncOnewayError( + "oneWayWithError", "syncHelloWorld:oneWayWithError", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startMultiThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiOneWayWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOnewayError( + "oneWayWithError", "syncHelloWorld:oneWayWithError", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerOneWayWithError() throws TException { + this.startSyncThreadedSelectorServer(this.port); + this.syncFramedClientOneWayWithError(this.port); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerOneWayWithErrorMuti() throws TException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWayWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerOneWayWithError() + throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + this.nonBlockClientOneWayWithError(this.port); + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerOneWayWithErrorMuti() + throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWayWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerOneWayWithError() + throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + this.nonBlockClientOneWayWithError(this.port); + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerOneWayWithErrorMuti() + throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWayWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWayWithError() throws TException { + this.startSyncNonblockingServer(this.port); + this.syncFramedClientOneWayWithError(this.port); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWayWithErrorMuti() throws TException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWayWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWayWithError() throws TException { + this.startSyncHsHaServer(this.port); + this.syncFramedClientOneWayWithError(this.port); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWayWithErrorMuti() throws TException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWayWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerOneWayWithError() throws TException { + this.startAsyncNonblockingServer(this.port); + this.syncFramedClientOneWayWithError(this.port); + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerOneWayWithErrorMuti() throws TException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWayWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerOneWayWithError() throws TException { + this.startAsyncHsHaServer(this.port); + this.syncFramedClientOneWayWithError(this.port); + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerOneWayWithErrorMuti() throws TException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWayWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsyncError("oneWayWithError", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWayWithError() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + this.nonBlockClientOneWayWithError(this.port); + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWayWithErrorMuti() + throws TException, IOException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWayWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWayWithError() throws TException, IOException { + this.startSyncHsHaServer(this.port); + this.nonBlockClientOneWayWithError(this.port); + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", 1); + } + + @Test + public void nonBlockMultiClientSyncHsHaServerMultiOneWayWithError() + throws TException, IOException { + this.startMultiSyncHsHaServer(this.port); + this.nonBlockClientMultiOneWayWithError(this.port); + this.waitAndAssertTracesClientAsyncServerSyncOnewayError( + "oneWayWithError", "syncHelloWorld:oneWayWithError", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWayWithErrorMuti() throws TException, IOException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWayWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncOnewayError("oneWayWithError", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerOneWayWithErrorError() { + Exception error = null; + try { + this.startAsyncNonblockingServer(this.port); + this.syncClientOneWayWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWayWithError", 1); + } + + @Test + public void syncClientSyncNonblockingServerOneWayWithErrorError() { + Exception error = null; + try { + this.startSyncNonblockingServer(this.port); + this.syncClientOneWayWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWayWithError", 1); + } + + @Test + public void syncClientAsyncHsHaServerOneWayWithErrorError() { + Exception error = null; + try { + this.startAsyncHsHaServer(this.port); + this.syncClientOneWayWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWayWithError", 1); + } + + @Test + public void syncClientSyncHsHaServerOneWayWithErrorError() { + Exception error = null; + try { + this.startSyncHsHaServer(this.port); + this.syncClientOneWayWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWayWithError", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerOneWayWithError() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + this.nonBlockClientOneWayWithError(this.port); + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerOneWayWithErrorMuti() + throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWayWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerOneWayWithError() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + this.nonBlockClientOneWayWithError(this.port); + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerOneWayWithErrorMuti() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWayWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerOneWayWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWayWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerOneWayWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsyncError("oneWayWithError", threadCount); + } + + public void syncClientOneWayWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.oneWayWithError()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncClientMultiOneWayWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + this.testing().runWithSpan("parent", () -> client.oneWayWithError()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientOneWayWithError(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.oneWayWithError_call no) {} + + @Override + public void onError(Exception e) { + Assertions.assertThat(e.getCause().getMessage()) + .isEqualTo("Read call frame size failed"); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.oneWayWithError(callback)); + } + + public void nonBlockClientMultiOneWayWithError(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + TMultiplexedProtocolFactory multiplexedProtocolFactory = + new TMultiplexedProtocolFactory(protocolFactory, "syncHelloWorld"); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, multiplexedProtocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.oneWayWithError_call no) {} + + @Override + public void onError(Exception e) { + Assertions.assertThat(e.getCause().getMessage()) + .isEqualTo("Read call frame size failed"); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.oneWayWithError(callback)); + } + + public void syncFramedClientOneWayWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.oneWayWithError()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFramedClientMultiOneWayWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + this.testing().runWithSpan("parent", () -> client.oneWayWithError()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientOneWayWithError(int port) throws IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.oneWayWithError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/OneWayTest.java b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/OneWayTest.java new file mode 100644 index 000000000000..038565d9826b --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/OneWayTest.java @@ -0,0 +1,1009 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_3; + +import io.opentelemetry.instrumentation.thrift.v0_9_3.common.TMultiplexedProtocolFactory; +import io.opentelemetry.instrumentation.thrift.v0_9_3.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class OneWayTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerOneWay() throws TException { + this.startSyncSimpleServer(this.port); + this.syncClientOneWay(this.port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", 1); + } + + @Test + public void syncClientSyncSimpleServerOneWayMuti() throws TException { + this.startSyncSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientOneWay(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("oneWay", 5); + } + + @Test + public void syncClientSyncSimpleServerOneWayParallel() throws TException, InterruptedException { + this.startSyncSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientOneWay(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerOneWay() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientOneWay(port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", 1); + } + + @Test + public void syncClientSyncThreadPoolServerOneWayMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientOneWay(port); + } + this.waitAndAssertTracesClientSyncServerSync("oneWay", 5); + } + + @Test + public void syncClientSyncThreadPoolServerOneWayParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientOneWay(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerOneWay() throws TException { + this.startMultiSimpleServer(this.port); + this.syncClientMultiOneWay(this.port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", "syncHelloWorld:oneWay", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerOneWayMuti() throws TException { + this.startMultiSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiOneWay(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("oneWay", "syncHelloWorld:oneWay", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerOneWayParallel() + throws TException, InterruptedException { + this.startMultiSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiOneWay(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerOneWayParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", "syncHelloWorld:oneWay", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerOneWayError() { + Exception error = null; + try { + this.startSyncThreadedSelectorServer(this.port); + this.syncClientOneWay(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWay", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerOneWayError() { + Exception error = null; + try { + this.startAsyncThreadedSelectorServer(this.port); + this.syncClientOneWay(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWay", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerOneWay() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + this.syncFramedClientOneWay(this.port); + this.waitAndAssertTracesClientSyncServerAsync("oneWay", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerOneWayMuti() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWay(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("oneWay", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerOneWayParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWay(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("oneWay", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerOneWay() throws TException { + this.startMultiThreadedSelectorServer(this.port); + this.syncFramedClientMultiOneWay(this.port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", "syncHelloWorld:oneWay", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerOneWayMuti() throws TException { + this.startMultiThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiOneWay(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("oneWay", "syncHelloWorld:oneWay", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerOneWayParallel() + throws TException, InterruptedException { + this.startMultiThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiOneWay(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", "syncHelloWorld:oneWay", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerOneWay() throws TException { + this.startSyncThreadedSelectorServer(this.port); + this.syncFramedClientOneWay(this.port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerOneWayMuti() throws TException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWay(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("oneWay", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerOneWayParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWay(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerOneWay() throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + this.nonBlockClientOneWay(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerOneWayMuti() throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWay(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerOneWayParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWay(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerOneWay() throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + this.nonBlockClientOneWay(this.port); + this.waitAndAssertTracesClientAsyncServerSync("oneWay", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerOneWayMuti() throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWay(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("oneWay", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerOneWayParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWay(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("oneWay", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWay() throws TException { + this.startSyncNonblockingServer(this.port); + this.syncFramedClientOneWay(this.port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWayMuti() throws TException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWay(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("oneWay", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerOneWayParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWay(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWay() throws TException { + this.startSyncHsHaServer(this.port); + this.syncFramedClientOneWay(this.port); + this.waitAndAssertTracesClientSyncServerSync("oneWay", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWayMuti() throws TException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWay(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("oneWay", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerOneWayParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWay(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("oneWay", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerOneWay() throws TException { + this.startAsyncNonblockingServer(this.port); + this.syncFramedClientOneWay(this.port); + this.waitAndAssertTracesClientSyncServerAsync("oneWay", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerOneWayMuti() throws TException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWay(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("oneWay", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerOneWayParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWay(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("oneWay", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerOneWay() throws TException { + this.startAsyncHsHaServer(this.port); + this.syncFramedClientOneWay(this.port); + this.waitAndAssertTracesClientSyncServerAsync("oneWay", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerOneWayMuti() throws TException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientOneWay(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("oneWay", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerOneWayParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientOneWay(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("oneWay", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWay() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + this.nonBlockClientOneWay(this.port); + this.waitAndAssertTracesClientAsyncServerSync("oneWay", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWayMuti() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWay(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("oneWay", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerOneWayParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWay(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("oneWay", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWay() throws TException, IOException { + this.startSyncHsHaServer(this.port); + this.nonBlockClientOneWay(this.port); + this.waitAndAssertTracesClientAsyncServerSync("oneWay", 1); + } + + @Test + public void nonBlockMultiClientSyncHsHaServerMultiOneWay() throws TException, IOException { + this.startMultiSyncHsHaServer(this.port); + this.nonBlockClientMultiOneWay(this.port); + this.waitAndAssertTracesClientAsyncServerSync("oneWay", "syncHelloWorld:oneWay", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWayMuti() throws TException, IOException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWay(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("oneWay", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerOneWayParallel() throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWay(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("oneWay", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerOneWayError() { + Exception error = null; + try { + this.startAsyncNonblockingServer(this.port); + this.syncClientOneWay(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWay", 1); + } + + @Test + public void syncClientSyncNonblockingServerOneWayError() { + Exception error = null; + try { + this.startSyncNonblockingServer(this.port); + this.syncClientOneWay(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWay", 1); + } + + @Test + public void syncClientAsyncHsHaServerOneWayError() { + Exception error = null; + try { + this.startAsyncHsHaServer(this.port); + this.syncClientOneWay(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWay", 1); + } + + @Test + public void syncClientSyncHsHaServerOneWayError() { + Exception error = null; + try { + this.startSyncHsHaServer(this.port); + this.syncClientOneWay(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServerOneway("oneWay", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerOneWay() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + this.nonBlockClientOneWay(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerOneWayMuti() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWay(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerOneWayParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWay(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerOneWay() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + this.nonBlockClientOneWay(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerOneWayMuti() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientOneWay(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerOneWayParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientOneWay(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerOneWayParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("oneWay", threadCount); + } + + public void syncClientOneWay(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.oneWay()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncClientMultiOneWay(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + this.testing().runWithSpan("parent", () -> client.oneWay()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientOneWay(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.oneWay_call no) {} + + @Override + public void onError(Exception e) { + Assertions.assertThat(e.getCause().getMessage()) + .isEqualTo("Read call frame size failed"); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.oneWay(callback)); + } + + public void nonBlockClientMultiOneWay(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + TMultiplexedProtocolFactory multiplexedProtocolFactory = + new TMultiplexedProtocolFactory(protocolFactory, "syncHelloWorld"); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, multiplexedProtocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.oneWay_call no) {} + + @Override + public void onError(Exception e) { + Assertions.assertThat(e.getCause().getMessage()) + .isEqualTo("Read call frame size failed"); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.oneWay(callback)); + } + + public void syncFramedClientOneWay(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + this.testing().runWithSpan("parent", () -> client.oneWay()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFramedClientMultiOneWay(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + this.testing().runWithSpan("parent", () -> client.oneWay()); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientOneWay(int port) throws IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.oneWay()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/SayHelloTest.java b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/SayHelloTest.java new file mode 100644 index 000000000000..91892a6a761e --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/SayHelloTest.java @@ -0,0 +1,1148 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_3; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_9_3.common.TMultiplexedProtocolFactory; +import io.opentelemetry.instrumentation.thrift.v0_9_3.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFastFramedTransport; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class SayHelloTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerSayHello() throws TException { + this.startSyncSimpleServer(this.port); + this.syncClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncClientSyncSimpleServerSayHelloMuti() throws TException { + this.startSyncSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientSayHello(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("sayHello", 5); + } + + @Test + public void syncClientSyncSimpleServerSayHelloParallel() throws TException, InterruptedException { + this.startSyncSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientSayHello(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("sayHello", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerSayHello() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientSayHello(port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncClientSyncThreadPoolServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientSayHello(port); + } + this.waitAndAssertTracesClientSyncServerSync("sayHello", 5); + } + + @Test + public void syncClientSyncThreadPoolServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientSayHello(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("sayHello", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerSayHello() throws TException { + this.startMultiSimpleServer(this.port); + this.syncClientMultiSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", "syncHelloWorld:sayHello", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerSayHelloMuti() throws TException { + this.startMultiSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiSayHello(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("sayHello", "syncHelloWorld:sayHello", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerSayHelloParallel() + throws TException, InterruptedException { + this.startMultiSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiSayHello(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "sayHello", "syncHelloWorld:sayHello", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerSayHelloError() { + Exception error = null; + try { + this.startSyncThreadedSelectorServer(this.port); + this.syncClientSayHello(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("sayHello", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerSayHelloError() { + Exception error = null; + try { + this.startAsyncThreadedSelectorServer(this.port); + this.syncClientSayHello(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("sayHello", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerSayHello() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + this.syncFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFastFramedClientAsyncThreadedSelectorServerSayHello() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + this.syncFastFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorFastServerSayHello() throws TException { + this.startAsyncThreadedSelectorFastServer(this.port); + this.syncFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFastFramedClientAsyncThreadedSelectorFastServerSayHello() throws TException { + this.startAsyncThreadedSelectorFastServer(this.port); + this.syncFastFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerSayHelloMuti() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientSayHello(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientSayHello(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerSayHello() throws TException { + this.startMultiThreadedSelectorServer(this.port); + this.syncFramedClientMultiSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", "syncHelloWorld:sayHello", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerSayHelloMuti() throws TException { + this.startMultiThreadedSelectorServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiSayHello(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("sayHello", "syncHelloWorld:sayHello", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + this.startMultiThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiSayHello(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "sayHello", "syncHelloWorld:sayHello", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerSayHello() throws TException { + this.startSyncThreadedSelectorServer(this.port); + this.syncFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFastFramedClientSyncThreadedSelectorServerSayHello() throws TException { + this.startSyncThreadedSelectorServer(this.port); + this.syncFastFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorFastServerSayHello() throws TException { + this.startSyncThreadedSelectorFastServer(this.port); + this.syncFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFastFramedClientSyncThreadedSelectorFastServerSayHello() throws TException { + this.startSyncThreadedSelectorFastServer(this.port); + this.syncFastFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerSayHelloMuti() throws TException { + this.startSyncThreadedSelectorServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncFramedClientSayHello(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("sayHello", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientSayHello(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("sayHello", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerSayHello() throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + this.nonBlockClientSayHello(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerSayHelloMuti() + throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + for (int i = 0; i < 5; ++i) { + this.nonBlockClientSayHello(this.port); + } + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientSayHello(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerSayHello() throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + this.nonBlockClientSayHello(this.port); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerSayHelloMuti() + throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + for (int i = 0; i < 5; ++i) { + this.nonBlockClientSayHello(this.port); + } + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientSayHello(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHello() throws TException { + this.startSyncNonblockingServer(this.port); + this.syncFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFastFramedClientSyncNonblockingServerSayHello() throws TException { + this.startSyncNonblockingServer(this.port); + this.syncFastFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFramedClientSyncNonblockingFastServerSayHello() throws TException { + this.startSyncNonblockingFastServer(this.port); + this.syncFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFastFramedClientSyncNonblockingFastServerSayHello() throws TException { + this.startSyncNonblockingFastServer(this.port); + this.syncFastFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHelloMuti() throws TException { + this.startSyncNonblockingServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncFramedClientSayHello(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("sayHello", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientSayHello(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("sayHello", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHello() throws TException { + this.startSyncHsHaServer(this.port); + this.syncFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFastFramedClientSyncHsHaServerSayHello() throws TException { + this.startSyncHsHaServer(this.port); + this.syncFastFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFramedClientSyncHsHaFastServerSayHello() throws TException { + this.startSyncHsHaFastServer(this.port); + this.syncFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFastFramedClientSyncHsHaFastServerSayHello() throws TException { + this.startSyncHsHaFastServer(this.port); + this.syncFastFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerSync("sayHello", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHelloMuti() throws TException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientSayHello(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("sayHello", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientSayHello(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("sayHello", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerSayHello() throws TException { + this.startAsyncNonblockingServer(this.port); + this.syncFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFastFramedClientAsyncNonblockingServerSayHello() throws TException { + this.startAsyncNonblockingServer(this.port); + this.syncFastFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerSayHelloMuti() throws TException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientSayHello(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientSayHello(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerSayHello() throws TException { + this.startAsyncHsHaServer(this.port); + this.syncFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFastFramedClientAsyncHsHaServerSayHello() throws TException { + this.startAsyncHsHaServer(this.port); + this.syncFastFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFramedClientAsyncHsHaFastServerSayHello() throws TException { + this.startAsyncHsHaFastServer(this.port); + this.syncFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFastFramedClientAsyncHsHaFastServerSayHello() throws TException { + this.startAsyncHsHaFastServer(this.port); + this.syncFastFramedClientSayHello(this.port); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerSayHelloMuti() throws TException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientSayHello(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("sayHello", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientSayHello(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("sayHello", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHello() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + this.nonBlockClientSayHello(this.port); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHelloMuti() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientSayHello(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientSayHello(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHello() throws TException, IOException { + this.startSyncHsHaServer(this.port); + this.nonBlockClientSayHello(this.port); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 1); + } + + @Test + public void nonBlockMultiClientSyncHsHaServerMultiSayHello() throws TException, IOException { + this.startMultiSyncHsHaServer(this.port); + this.nonBlockClientMultiSayHello(this.port); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", "syncHelloWorld:sayHello", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHelloMuti() throws TException, IOException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientSayHello(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("sayHello", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientSayHello(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("sayHello", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerSayHelloError() { + Exception error = null; + try { + this.startAsyncNonblockingServer(this.port); + this.syncClientSayHello(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("sayHello", 1); + } + + @Test + public void syncClientSyncNonblockingServerSayHelloError() { + Exception error = null; + try { + this.startSyncNonblockingServer(this.port); + this.syncClientSayHello(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("sayHello", 1); + } + + @Test + public void syncClientAsyncHsHaServerSayHelloError() { + Exception error = null; + try { + this.startAsyncHsHaServer(this.port); + this.syncClientSayHello(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("sayHello", 1); + } + + @Test + public void syncClientSyncHsHaServerSayHelloError() { + Exception error = null; + try { + this.startSyncHsHaServer(this.port); + this.syncClientSayHello(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("sayHello", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerSayHello() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + this.nonBlockClientSayHello(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerSayHelloMuti() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientSayHello(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientSayHello(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerSayHello() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + this.nonBlockClientSayHello(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerSayHelloMuti() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientSayHello(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientSayHello(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("sayHello", threadCount); + } + + public void syncClientSayHello(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.sayHello("US", "Bob")); + Assertions.assertThat(response).isEqualTo("Hello USs' Bob"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncClientMultiSayHello(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + String response = this.testing().runWithSpan("parent", () -> client.sayHello("US", "Bob")); + Assertions.assertThat(response).isEqualTo("Hello USs' Bob"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientSayHello(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.sayHello_call s) { + try { + String result = s.getResult(); + Assertions.assertThat(result).isEqualTo("Hello USs' Bob"); + } catch (TException e) { + throw new VerifyException(e); + } + } + + @Override + public void onError(Exception e) { + Assertions.assertThat(e.getCause().getMessage()) + .isEqualTo("Read call frame size failed"); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.sayHello("US", "Bob", callback)); + } + + public void nonBlockClientMultiSayHello(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + TMultiplexedProtocolFactory multiplexedProtocolFactory = + new TMultiplexedProtocolFactory(protocolFactory, "syncHelloWorld"); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, multiplexedProtocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.sayHello_call s) { + try { + String result = s.getResult(); + Assertions.assertThat(result).isEqualTo("Hello USs' Bob"); + } catch (TException e) { + throw new VerifyException(e); + } + } + + @Override + public void onError(Exception e) { + Assertions.assertThat(e.getCause().getMessage()) + .isEqualTo("Read call frame size failed"); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.sayHello("US", "Bob", callback)); + } + + public void syncFramedClientSayHello(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.sayHello("US", "Bob")); + Assertions.assertThat(response).isEqualTo("Hello USs' Bob"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFastFramedClientSayHello(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFastFramedTransport framedTransport = new TFastFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.sayHello("US", "Bob")); + Assertions.assertThat(response).isEqualTo("Hello USs' Bob"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFramedClientMultiSayHello(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + String response = this.testing().runWithSpan("parent", () -> client.sayHello("US", "Bob")); + Assertions.assertThat(response).isEqualTo("Hello USs' Bob"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientSayHello(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.sayHello("US", "Bob")); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/TestSaslCallbackHandler.java b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/TestSaslCallbackHandler.java new file mode 100644 index 000000000000..fa92e318bf2c --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/TestSaslCallbackHandler.java @@ -0,0 +1,47 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_3; + +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.NameCallback; +import javax.security.auth.callback.PasswordCallback; +import javax.security.auth.callback.UnsupportedCallbackException; +import javax.security.sasl.AuthorizeCallback; +import javax.security.sasl.RealmCallback; + +public class TestSaslCallbackHandler implements CallbackHandler { + public static final String PRINCIPAL = "thrift-test-principal"; + public static final String REALM = "thrift-test-realm"; + private final String password; + + public TestSaslCallbackHandler(String password) { + this.password = password; + } + + @Override + public void handle(Callback[] callbacks) throws UnsupportedCallbackException { + Callback[] var2 = callbacks; + int var3 = callbacks.length; + + for (int var4 = 0; var4 < var3; ++var4) { + Callback c = var2[var4]; + if (c instanceof NameCallback) { + ((NameCallback) c).setName("thrift-test-principal"); + } else if (c instanceof PasswordCallback) { + ((PasswordCallback) c).setPassword(this.password.toCharArray()); + } else if (c instanceof AuthorizeCallback) { + ((AuthorizeCallback) c).setAuthorized(true); + } else { + if (!(c instanceof RealmCallback)) { + throw new UnsupportedCallbackException(c); + } + + ((RealmCallback) c).setText("thrift-test-realm"); + } + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/ThriftBaseTest.java b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/ThriftBaseTest.java new file mode 100644 index 000000000000..0957728bc71c --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/ThriftBaseTest.java @@ -0,0 +1,1072 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_3; + +import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo; +import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.satisfies; + +import com.google.common.base.VerifyException; +import io.opentelemetry.api.common.AttributeKey; +import io.opentelemetry.api.trace.SpanKind; +import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension; +import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; +import io.opentelemetry.instrumentation.thrift.v0_9_3.server.ThriftServiceAsyncImpl; +import io.opentelemetry.instrumentation.thrift.v0_9_3.server.ThriftServiceImpl; +import io.opentelemetry.instrumentation.thrift.v0_9_3.thrift.ThriftService; +import io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions; +import io.opentelemetry.sdk.testing.assertj.SpanDataAssert; +import io.opentelemetry.sdk.testing.assertj.TraceAssert; +import io.opentelemetry.sdk.trace.data.StatusData; +import io.opentelemetry.semconv.SemanticAttributes; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.nio.charset.Charset; +import java.util.Random; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.function.Consumer; +import java.util.logging.Logger; +import org.apache.thrift.TMultiplexedProcessor; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.server.THsHaServer; +import org.apache.thrift.server.TNonblockingServer; +import org.apache.thrift.server.TServer; +import org.apache.thrift.server.TSimpleServer; +import org.apache.thrift.server.TThreadPoolServer; +import org.apache.thrift.server.TThreadedSelectorServer; +import org.apache.thrift.transport.TFastFramedTransport; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingServerSocket; +import org.apache.thrift.transport.TNonblockingServerTransport; +import org.apache.thrift.transport.TServerSocket; +import org.apache.thrift.transport.TServerTransport; +import org.apache.thrift.transport.TTransportException; +import org.assertj.core.api.AbstractAssert; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.extension.RegisterExtension; + +public abstract class ThriftBaseTest { + private static final Logger logger = Logger.getLogger(ThriftBaseTest.class.getName()); + public TServer server; + public int port = 13100; + + private static final String ASYNC_CLIENT = + "io.opentelemetry.instrumentation.thrift.v0_9_3.thrift.ThriftService$AsyncClient"; + private static final String SYNC_CLIENT = + "io.opentelemetry.instrumentation.thrift.v0_9_3.thrift.ThriftService$Client"; + private static final String ASYNC_SERVER = + "io.opentelemetry.instrumentation.thrift.v0_9_3.server.ThriftServiceAsyncImpl"; + private static final String SYNC_SERVER = + "io.opentelemetry.instrumentation.thrift.v0_9_3.server.ThriftServiceImpl"; + private static final String PEER_NAME = "localhost"; + private static final String PEER_ADDR = "127.0.0.1"; + + private static final String TRANSPORT_EXCEPTION = + "org.apache.thrift.transport.TTransportException"; + private static final String VERIFY_EXCEPTION = "com.google.common.base.VerifyException"; + // private static final String APP_EXCEPTION = "org.apache.thrift.TApplicationException"; + private static final String IO_EXCEPTION = "java.io.IOException"; + + @RegisterExtension + static InstrumentationExtension testing = AgentInstrumentationExtension.create(); + + protected InstrumentationExtension testing() { + return testing; + } + + @BeforeEach + public void before() { + System.setProperty("otel.javaagent.debug", "true"); + ++this.port; + logger.info( + "before port=" + + this.port + + ", threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.testing().clearData(); + } + + @AfterEach + public void after() throws InterruptedException { + this.stopServer(); + } + + public int getPort() { + Random random = new Random(); + int newPort = this.port + random.nextInt(2000); + while (portNotRelease(newPort)) { + newPort = this.port + random.nextInt(2000); + } + return newPort; + } + + public static boolean portNotRelease(int port) { + Process process = null; + String pid = null; + try { + process = Runtime.getRuntime().exec("lsof -ti:" + port); + BufferedReader reader = + new BufferedReader( + new InputStreamReader(process.getInputStream(), Charset.defaultCharset())); + pid = reader.readLine(); + } catch (IOException e) { + throw new VerifyException(e); + } + return pid != null && !pid.isEmpty(); + } + + public void startSyncSimpleServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TServerTransport serverTransport = new TServerSocket(port); + this.server = new TSimpleServer(new TServer.Args(serverTransport).processor(processor)); + new Thread( + () -> { + logger.info( + "Starting startSyncSimpleServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startAsyncSimpleServer(int port) throws TTransportException { + ThriftServiceAsyncImpl impl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor processor = + new ThriftService.AsyncProcessor(impl); + TServerTransport serverTransport = new TServerSocket(port); + this.server = new TSimpleServer(new TServer.Args(serverTransport).processor(processor)); + new Thread( + () -> { + logger.info( + "Starting startAsyncSimpleServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startMultiSimpleServer(int port) throws TTransportException { + ThriftServiceImpl syncImpl = new ThriftServiceImpl(); + ThriftService.Processor syncProcessor = + new ThriftService.Processor(syncImpl); + ThriftServiceAsyncImpl asyncImpl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor asyncProcessor = + new ThriftService.AsyncProcessor(asyncImpl); + TMultiplexedProcessor multiplexedProcessor = new TMultiplexedProcessor(); + multiplexedProcessor.registerProcessor("syncHelloWorld", syncProcessor); + multiplexedProcessor.registerProcessor("asyncHelloWorld", asyncProcessor); + TServerTransport serverTransport = new TServerSocket(port); + this.server = + new TSimpleServer(new TServer.Args(serverTransport).processor(multiplexedProcessor)); + new Thread( + () -> { + logger.info( + "Starting startMultiSimpleServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startMultiThreadedSelectorServer(int port) throws TTransportException { + ThriftServiceImpl syncImpl = new ThriftServiceImpl(); + ThriftService.Processor syncProcessor = + new ThriftService.Processor(syncImpl); + ThriftServiceAsyncImpl asyncImpl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor asyncProcessor = + new ThriftService.AsyncProcessor(asyncImpl); + TMultiplexedProcessor multiplexedProcessor = new TMultiplexedProcessor(); + multiplexedProcessor.registerProcessor("syncHelloWorld", syncProcessor); + multiplexedProcessor.registerProcessor("asyncHelloWorld", asyncProcessor); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TThreadedSelectorServer.Args serverArgs = + new TThreadedSelectorServer.Args(transport) + .selectorThreads(5) + .workerThreads(10) + .acceptQueueSizePerThread(20) + .processor(multiplexedProcessor); + this.server = new TThreadedSelectorServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startMultiThreadedSelectorServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startSyncThreadedSelectorServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TThreadedSelectorServer.Args serverArgs = + new TThreadedSelectorServer.Args(transport) + .selectorThreads(5) + .workerThreads(10) + .acceptQueueSizePerThread(20) + .processor(processor); + this.server = new TThreadedSelectorServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startAsyncServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startSyncThreadedSelectorFastServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TThreadedSelectorServer.Args serverArgs = + new TThreadedSelectorServer.Args(transport) + .selectorThreads(5) + .workerThreads(10) + .acceptQueueSizePerThread(20) + .processor(processor) + .transportFactory(new TFastFramedTransport.Factory()); + this.server = new TThreadedSelectorServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startAsyncServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startAsyncThreadedSelectorServer(int port) throws TTransportException { + ThriftServiceAsyncImpl impl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor processor = + new ThriftService.AsyncProcessor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TThreadedSelectorServer.Args serverArgs = + new TThreadedSelectorServer.Args(transport) + .selectorThreads(5) + .workerThreads(10) + .acceptQueueSizePerThread(20) + .processor(processor); + this.server = new TThreadedSelectorServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startNonBlockingServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startAsyncThreadedSelectorFastServer(int port) throws TTransportException { + ThriftServiceAsyncImpl impl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor processor = + new ThriftService.AsyncProcessor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TThreadedSelectorServer.Args serverArgs = + new TThreadedSelectorServer.Args(transport) + .selectorThreads(5) + .workerThreads(10) + .acceptQueueSizePerThread(20) + .processor(processor) + .transportFactory(new TFastFramedTransport.Factory()); + this.server = new TThreadedSelectorServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startNonBlockingServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startSyncNonblockingServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TNonblockingServer.Args serverArgs = + new TNonblockingServer.Args(transport).processor(processor); + this.server = new TNonblockingServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startNonBlockingServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startSyncNonblockingFastServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TNonblockingServer.Args serverArgs = + new TNonblockingServer.Args(transport) + .processor(processor) + .transportFactory(new TFastFramedTransport.Factory()) + .protocolFactory(new TBinaryProtocol.Factory()); + this.server = new TNonblockingServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startNonBlockingServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startAsyncNonblockingServer(int port) throws TTransportException { + ThriftServiceAsyncImpl impl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor processor = + new ThriftService.AsyncProcessor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TNonblockingServer.Args serverArgs = + new TNonblockingServer.Args(transport).processor(processor); + this.server = new TNonblockingServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startNonBlockingServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startAsyncThreadPoolServer(int port) throws TTransportException { + ThriftServiceAsyncImpl impl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor processor = + new ThriftService.AsyncProcessor(impl); + TServerSocket transport = new TServerSocket(port); + TThreadPoolServer.Args serverArgs = + new TThreadPoolServer.Args(transport) + .minWorkerThreads(5) + .maxWorkerThreads(10) + .processor(processor); + TServer server = new TThreadPoolServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startNonBlockingServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + server.serve(); + }) + .start(); + } + + public void startSyncThreadPoolServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TServerSocket transport = new TServerSocket(port); + ExecutorService executor = Executors.newFixedThreadPool(5); + TThreadPoolServer.Args serverArgs = + new TThreadPoolServer.Args(transport).executorService(executor).processor(processor); + TServer server = new TThreadPoolServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startSyncThreadPoolServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + server.serve(); + }) + .start(); + } + + public void startSyncHsHaServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TBinaryProtocol.Factory protocolFactory = new TBinaryProtocol.Factory(); + TFramedTransport.Factory transportFactory = new TFramedTransport.Factory(); + THsHaServer.Args serverArgs = + new THsHaServer.Args(transport) + .processor(processor) + .protocolFactory(protocolFactory) + .transportFactory(transportFactory); + this.server = new THsHaServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startSyncTHsHaServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startMultiSyncHsHaServer(int port) throws TTransportException { + ThriftServiceImpl syncImpl = new ThriftServiceImpl(); + ThriftService.Processor syncProcessor = + new ThriftService.Processor(syncImpl); + ThriftServiceAsyncImpl asyncImpl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor asyncProcessor = + new ThriftService.AsyncProcessor(asyncImpl); + TMultiplexedProcessor multiplexedProcessor = new TMultiplexedProcessor(); + multiplexedProcessor.registerProcessor("syncHelloWorld", syncProcessor); + multiplexedProcessor.registerProcessor("asyncHelloWorld", asyncProcessor); + + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TBinaryProtocol.Factory protocolFactory = new TBinaryProtocol.Factory(); + TFramedTransport.Factory transportFactory = new TFramedTransport.Factory(); + THsHaServer.Args serverArgs = + new THsHaServer.Args(transport) + .processor(multiplexedProcessor) + .protocolFactory(protocolFactory) + .transportFactory(transportFactory); + this.server = new THsHaServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startSyncTHsHaServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startSyncHsHaFastServer(int port) throws TTransportException { + ThriftServiceImpl impl = new ThriftServiceImpl(); + ThriftService.Processor processor = + new ThriftService.Processor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TBinaryProtocol.Factory protocolFactory = new TBinaryProtocol.Factory(); + TFastFramedTransport.Factory transportFactory = new TFastFramedTransport.Factory(); + THsHaServer.Args serverArgs = + new THsHaServer.Args(transport) + .processor(processor) + .protocolFactory(protocolFactory) + .transportFactory(transportFactory); + this.server = new THsHaServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startSyncTHsHaServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startAsyncHsHaServer(int port) throws TTransportException { + ThriftServiceAsyncImpl impl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor processor = + new ThriftService.AsyncProcessor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TBinaryProtocol.Factory protocolFactory = new TBinaryProtocol.Factory(); + TFramedTransport.Factory transportFactory = new TFramedTransport.Factory(); + THsHaServer.Args serverArgs = + new THsHaServer.Args(transport) + .processor(processor) + .protocolFactory(protocolFactory) + .transportFactory(transportFactory); + this.server = new THsHaServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startAsyncTHsHaServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void startAsyncHsHaFastServer(int port) throws TTransportException { + ThriftServiceAsyncImpl impl = new ThriftServiceAsyncImpl(); + ThriftService.AsyncProcessor processor = + new ThriftService.AsyncProcessor(impl); + TNonblockingServerTransport transport = new TNonblockingServerSocket(port); + TBinaryProtocol.Factory protocolFactory = new TBinaryProtocol.Factory(); + TFastFramedTransport.Factory transportFactory = new TFastFramedTransport.Factory(); + THsHaServer.Args serverArgs = + new THsHaServer.Args(transport) + .processor(processor) + .protocolFactory(protocolFactory) + .transportFactory(transportFactory); + this.server = new THsHaServer(serverArgs); + new Thread( + () -> { + logger.info( + "Starting startAsyncTHsHaServer threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + this.server.serve(); + }) + .start(); + } + + public void stopServer() { + if (this.server != null) { + this.server.stop(); + logger.info( + "Server stopped" + + ", threadName=" + + Thread.currentThread().getName() + + ", threadId=" + + Thread.currentThread().getId()); + } + } + + public void waitAndAssertTracesClientSyncServerSync(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.unset(), + null, + null); + } + + public void waitAndAssertTracesClientSyncServerSync( + String clientMethod, String serverMethod, int count) { + this.baseWaitAndAssertTraces( + clientMethod, + serverMethod, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.unset(), + null, + null); + } + + @SuppressWarnings("UngroupedOverloads") + public void waitAndAssertTracesClientSyncServerSyncWithError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> val.isIn(null, "Internal error processing " + method), + TRANSPORT_EXCEPTION, + SYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientSyncServerSyncWithError( + String clientMethod, String serverMethod, int count) { + this.baseWaitAndAssertTraces( + clientMethod, + serverMethod, + count, + SYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> val.isIn(null, "Internal error processing " + clientMethod), + TRANSPORT_EXCEPTION, + SYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientSyncServerSyncOnewayError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientSyncServerSyncOnewayError( + String clientMethod, String serverMethod, int count) { + this.baseWaitAndAssertTraces( + clientMethod, + serverMethod, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientAsyncServerAsync(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + ASYNC_SERVER, + StatusData.unset(), + null, + null); + } + + public void waitAndAssertTracesClientAsyncServerAsyncError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + ASYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientAsyncServerAsyncWithError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> val.isIn("Read call frame size failed", "fail"), + IO_EXCEPTION, + ASYNC_SERVER, + StatusData.error(), + val -> val.isIn("Read call frame size failed", "fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientAsyncServerSync(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.unset(), + null, + null); + } + + public void waitAndAssertTracesClientAsyncServerSync( + String clientMethod, String serverMethod, int count) { + this.baseWaitAndAssertTraces( + clientMethod, + serverMethod, + count, + ASYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.unset(), + null, + null); + } + + public void waitAndAssertTracesClientAsyncServerSyncWithError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> val.isIn("Read call frame size failed", "Internal error processing " + method), + IO_EXCEPTION, + SYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientAsyncServerSyncWithError( + String clientMethod, String serverMethod, int count) { + this.baseWaitAndAssertTraces( + clientMethod, + serverMethod, + count, + ASYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> val.isIn("Read call frame size failed", "Internal error processing " + clientMethod), + IO_EXCEPTION, + SYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientAsyncServerSyncOnewayError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + ASYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientAsyncServerSyncOnewayError( + String clientMethod, String serverMethod, int count) { + this.baseWaitAndAssertTraces( + clientMethod, + serverMethod, + count, + ASYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + SYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) // 测试代码 + public void waitAndAssertTracesClientSyncServerAsync(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + ASYNC_SERVER, + StatusData.unset(), + null, + null); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) // 测试代码 + public void waitAndAssertTracesClientSyncServerAsyncError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + ASYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) // 测试代码 + public void waitAndAssertTracesClientSyncServerAsyncWithError(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> val.isIn(null, "fail"), + TRANSPORT_EXCEPTION, + ASYNC_SERVER, + StatusData.error(), + val -> val.isIn("fail"), + VERIFY_EXCEPTION); + } + + public void waitAndAssertTracesClientSyncNoServer(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.error(), + PEER_NAME, + PEER_ADDR, + val -> + val.isIn( + null, "Socket is closed by peer.", "java.net.SocketException: Connection reset"), + TRANSPORT_EXCEPTION, + null, + null, + null, + null); + } + + public void waitAndAssertTracesClientSyncNoServerOneway(String method, int count) { + this.baseWaitAndAssertTraces( + method, + method, + count, + SYNC_CLIENT, + StatusData.unset(), + PEER_NAME, + PEER_ADDR, + null, + null, + null, + null, + null, + null); + } + + public void waitAndAssertTracesClientSyncNoServerNoSasl(String method, int count) { + this.baseWaitAndAssertTraces( + method, + null, + count, + SYNC_CLIENT, + StatusData.error(), + null, + null, + val -> val.isIn("SASL authentication not complete"), + TRANSPORT_EXCEPTION, + null, + null, + null, + null); + } + + @SuppressWarnings({"rawtypes", "unchecked"}) // 测试代码 + private void baseWaitAndAssertTraces( + String clientMethod, + String serverMethod, + int count, + String clientClass, + StatusData clientStatus, + String peerName, + String peerAddr, + OpenTelemetryAssertions.StringAssertConsumer clientAssertion, + String clientErrorType, + String serverClass, + StatusData serverStatus, + OpenTelemetryAssertions.StringAssertConsumer serviceAssertion, + String serverErrorType) { + Consumer[] consumers = new Consumer[count]; + Consumer traceAssertConsumer; + if (serverClass == null) { + traceAssertConsumer = + trace -> + trace.hasSpansSatisfyingExactly( + span -> span.hasName("parent").hasKind(SpanKind.INTERNAL).hasNoParent(), + clientSpanDataAssertConsumer( + clientMethod, + clientClass, + clientStatus, + trace, + peerName, + peerAddr, + clientAssertion, + clientErrorType)); + } else { + traceAssertConsumer = + trace -> + trace.hasSpansSatisfyingExactly( + span -> span.hasName("parent").hasKind(SpanKind.INTERNAL).hasNoParent(), + clientSpanDataAssertConsumer( + clientMethod, + clientClass, + clientStatus, + trace, + peerName, + peerAddr, + clientAssertion, + clientErrorType), + serverSpanDataAssertConsumer( + serverMethod, + serverClass, + serverStatus, + trace, + serviceAssertion, + serverErrorType)); + } + + for (int i = 0; i < count; ++i) { + consumers[i] = traceAssertConsumer; + } + this.testing().waitAndAssertTraces(consumers); + } + + @SuppressWarnings({"ReturnValueIgnored"}) + private static Consumer clientSpanDataAssertConsumer( + String clientMethod, + String clientClass, + StatusData statusData, + TraceAssert trace, + String peerName, + String peerAddr, + OpenTelemetryAssertions.StringAssertConsumer errorMsgAssertion, + String errorType) { + Consumer consumer = + span -> + span.hasName(clientMethod) + .hasKind(SpanKind.CLIENT) + .hasParent(trace.getSpan(0)) + .hasStatus(statusData) + .hasAttributesSatisfying( + equalTo(AttributeKey.stringKey("net.sock.peer.name"), peerName), + equalTo(AttributeKey.stringKey("net.sock.peer.addr"), peerAddr), + equalTo(SemanticAttributes.RPC_SYSTEM, "thrift"), + equalTo(SemanticAttributes.RPC_SERVICE, clientClass), + equalTo(SemanticAttributes.RPC_METHOD, clientMethod)); + if (statusData == StatusData.error()) { + consumer = + consumer.andThen( + span -> + span.hasEventsSatisfyingExactly( + event -> + event + .hasName(SemanticAttributes.EXCEPTION_EVENT_NAME) + .hasAttributesSatisfyingExactly( + satisfies( + SemanticAttributes.EXCEPTION_MESSAGE, errorMsgAssertion), + satisfies( + AttributeKey.stringKey("exception.stacktrace"), + AbstractAssert::isNotNull), + equalTo(SemanticAttributes.EXCEPTION_TYPE, errorType)))); + } + return consumer; + } + + @SuppressWarnings({"ReturnValueIgnored"}) + private static Consumer serverSpanDataAssertConsumer( + String serverMethod, + String serverClass, + StatusData statusData, + TraceAssert trace, + OpenTelemetryAssertions.StringAssertConsumer errorMsgAssertion, + String errorType) { + Consumer consumer = + span -> + span.hasName(serverMethod) + .hasKind(SpanKind.SERVER) + .hasParent(trace.getSpan(1)) + .hasStatus(statusData) + .hasAttributesSatisfying( + equalTo(AttributeKey.stringKey("net.sock.peer.addr"), "127.0.0.1"), + equalTo(SemanticAttributes.RPC_SYSTEM, "thrift"), + equalTo(SemanticAttributes.RPC_SERVICE, serverClass), + equalTo(SemanticAttributes.RPC_METHOD, serverMethod)); + if (statusData == StatusData.error()) { + consumer = + consumer.andThen( + span -> + span.hasEventsSatisfyingExactly( + event -> + event + .hasName(SemanticAttributes.EXCEPTION_EVENT_NAME) + .hasAttributesSatisfyingExactly( + satisfies( + SemanticAttributes.EXCEPTION_MESSAGE, errorMsgAssertion), + satisfies( + AttributeKey.stringKey("exception.stacktrace"), + AbstractAssert::isNotNull), + equalTo(SemanticAttributes.EXCEPTION_TYPE, errorType)))); + } + return consumer; + } +} diff --git a/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/WithDelayTest.java b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/WithDelayTest.java new file mode 100644 index 000000000000..67d4c4a7ce28 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/WithDelayTest.java @@ -0,0 +1,995 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_3; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_9_3.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class WithDelayTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerSayHello() throws TException { + this.startSyncSimpleServer(this.port); + this.syncClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", 1); + } + + @Test + public void syncClientSyncSimpleServerSayHelloMuti() throws TException { + this.startSyncSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithDelay(this.port, 2); + } + this.waitAndAssertTracesClientSyncServerSync("withDelay", 5); + } + + @Test + public void syncClientSyncSimpleServerSayHelloParallel() throws TException, InterruptedException { + this.startSyncSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithDelay(this.port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withDelay", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerSayHello() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientWithDelay(port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", 1); + } + + @Test + public void syncClientSyncThreadPoolServerSayHelloMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithDelay(port, 2); + } + this.waitAndAssertTracesClientSyncServerSync("withDelay", 5); + } + + @Test + public void syncClientSyncThreadPoolServerSayHelloParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithDelay(port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withDelay", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerSayHello() throws TException { + this.startMultiSimpleServer(this.port); + this.syncClientMultiWithDelay(this.port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", "syncHelloWorld:withDelay", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerSayHelloMuti() throws TException { + this.startMultiSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiWithDelay(this.port, 2); + } + this.waitAndAssertTracesClientSyncServerSync("withDelay", "syncHelloWorld:withDelay", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerSayHelloParallel() + throws TException, InterruptedException { + this.startMultiSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiWithDelay(this.port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerSayHelloParallel field: " + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "withDelay", "syncHelloWorld:withDelay", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerSayHelloError() { + Exception error = null; + try { + this.startSyncThreadedSelectorServer(this.port); + this.syncClientWithDelay(this.port, 2); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withDelay", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerSayHelloError() { + Exception error = null; + try { + this.startAsyncThreadedSelectorServer(this.port); + this.syncClientWithDelay(this.port, 2); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withDelay", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerSayHello() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + this.syncFramedClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientSyncServerAsync("withDelay", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerSayHelloMuti() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientSyncServerAsync("withDelay", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithDelay(this.port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("withDelay", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerSayHello() throws TException { + this.startMultiThreadedSelectorServer(this.port); + this.syncFramedClientMultiWithDelay(this.port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", "syncHelloWorld:withDelay", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerSayHelloMuti() throws TException { + this.startMultiThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientSyncServerSync("withDelay", "syncHelloWorld:withDelay", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + this.startMultiThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiWithDelay(this.port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "withDelay", "syncHelloWorld:withDelay", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerSayHello() throws TException { + this.startSyncThreadedSelectorServer(this.port); + this.syncFramedClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerSayHelloMuti() throws TException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientSyncServerSync("withDelay", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithDelay(this.port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withDelay", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerSayHello() throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + this.nonBlockClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerSayHelloMuti() + throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithDelay(this.port, 2); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerSayHello() throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + this.nonBlockClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerSayHelloMuti() + throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithDelay(this.port, 2); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHello() throws TException { + this.startSyncNonblockingServer(this.port); + this.syncFramedClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHelloMuti() throws TException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientSyncServerSync("withDelay", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithDelay(this.port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withDelay", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHello() throws TException { + this.startSyncHsHaServer(this.port); + this.syncFramedClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientSyncServerSync("withDelay", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHelloMuti() throws TException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientSyncServerSync("withDelay", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithDelay(this.port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withDelay", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerSayHello() throws TException { + this.startAsyncNonblockingServer(this.port); + this.syncFramedClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientSyncServerAsync("withDelay", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerSayHelloMuti() throws TException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientSyncServerAsync("withDelay", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithDelay(this.port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("withDelay", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerSayHello() throws TException { + this.startAsyncHsHaServer(this.port); + this.syncFramedClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientSyncServerAsync("withDelay", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerSayHelloMuti() throws TException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientSyncServerAsync("withDelay", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithDelay(this.port, 2); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("withDelay", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHello() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + this.nonBlockClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHelloMuti() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithDelay(this.port, 1); + } + + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithDelay(this.port, 1); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHello() throws TException, IOException { + this.startSyncHsHaServer(this.port); + this.nonBlockClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHelloMuti() throws TException, IOException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientAsyncServerSync("withDelay", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithDelay(this.port, 2); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withDelay", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerSayHelloError() { + Exception error = null; + try { + this.startAsyncNonblockingServer(this.port); + this.syncClientWithDelay(this.port, 2); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withDelay", 1); + } + + @Test + public void syncClientSyncNonblockingServerSayHelloError() { + Exception error = null; + try { + this.startSyncNonblockingServer(this.port); + this.syncClientWithDelay(this.port, 2); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withDelay", 1); + } + + @Test + public void syncClientAsyncHsHaServerSayHelloError() { + Exception error = null; + try { + this.startAsyncHsHaServer(this.port); + this.syncClientWithDelay(this.port, 2); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withDelay", 1); + } + + @Test + public void syncClientSyncHsHaServerSayHelloError() { + Exception error = null; + try { + this.startSyncHsHaServer(this.port); + this.syncClientWithDelay(this.port, 2); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withDelay", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerSayHello() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + this.nonBlockClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerSayHelloMuti() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithDelay(this.port, 2); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerSayHello() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + this.nonBlockClientWithDelay(this.port, 2); + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerSayHelloMuti() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithDelay(this.port, 2); + } + + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerSayHelloParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithDelay(this.port, 2); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerSayHelloParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("withDelay", threadCount); + } + + public void syncClientWithDelay(int port, int delay) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.withDelay(delay)); + Assertions.assertThat(response).isEqualTo("delay " + delay); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncClientMultiWithDelay(int port, int delay) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + String response = this.testing().runWithSpan("parent", () -> client.withDelay(delay)); + Assertions.assertThat(response).isEqualTo("delay " + delay); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientWithDelay(int port, int delay) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.withDelay_call s) { + try { + String result = s.getResult(); + Assertions.assertThat(result).isEqualTo("delay " + delay); + } catch (TException e) { + throw new VerifyException(e); + } + } + + @Override + public void onError(Exception e) { + Assertions.assertThat(e.getCause().getMessage()) + .isEqualTo("Read call frame size failed"); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.withDelay(delay, callback)); + } + + public void syncFramedClientWithDelay(int port, int delay) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.withDelay(delay)); + Assertions.assertThat(response).isEqualTo("delay " + delay); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFramedClientMultiWithDelay(int port, int delay) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + String response = this.testing().runWithSpan("parent", () -> client.withDelay(delay)); + Assertions.assertThat(response).isEqualTo("delay " + delay); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientWithDelay(int port, int delay) throws IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withDelay(delay)); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/WithErrorTest.java b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/WithErrorTest.java new file mode 100644 index 000000000000..4a640a6089ec --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/WithErrorTest.java @@ -0,0 +1,1062 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_3; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_9_3.common.TMultiplexedProtocolFactory; +import io.opentelemetry.instrumentation.thrift.v0_9_3.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class WithErrorTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerWithError() throws TException { + this.startSyncSimpleServer(this.port); + this.syncClientWithError(this.port); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 1); + } + + @Test + public void syncClientSyncSimpleServerWithErrorMuti() throws TException { + this.startSyncSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithError(this.port); + } + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 5); + } + + @Test + public void syncClientSyncSimpleServerWithErrorParallel() + throws TException, InterruptedException { + this.startSyncSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerWithError() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientWithError(port); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 1); + } + + @Test + public void syncClientSyncThreadPoolServerWithErrorMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithError(port); + } + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 5); + } + + @Test + public void syncClientSyncThreadPoolServerWithErrorParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithError(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerWithError() throws TException { + this.startMultiSimpleServer(this.port); + this.syncClientMultiWithError(this.port); + this.waitAndAssertTracesClientSyncServerSyncWithError( + "withError", "syncHelloWorld:withError", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerWithErrorMuti() throws TException { + this.startMultiSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiWithError(this.port); + } + this.waitAndAssertTracesClientSyncServerSyncWithError( + "withError", "syncHelloWorld:withError", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerWithErrorParallel() + throws TException, InterruptedException { + this.startMultiSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError( + "withError", "syncHelloWorld:withError", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerWithErrorError() { + Exception error = null; + try { + this.startSyncThreadedSelectorServer(this.port); + this.syncClientWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServer("withError", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerWithErrorError() { + Exception error = null; + try { + this.startAsyncThreadedSelectorServer(this.port); + this.syncClientWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServer("withError", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithError() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + this.syncFramedClientWithError(this.port); + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithErrorMuti() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithError() throws TException { + this.startMultiThreadedSelectorServer(this.port); + this.syncFramedClientMultiWithError(this.port); + this.waitAndAssertTracesClientSyncServerSyncWithError( + "withError", "syncHelloWorld:withError", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithErrorMuti() throws TException { + this.startMultiThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerSyncWithError( + "withError", "syncHelloWorld:withError", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithErrorParallel() + throws TException, InterruptedException { + this.startMultiThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError( + "withError", "syncHelloWorld:withError", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithError() throws TException { + this.startSyncThreadedSelectorServer(this.port); + this.syncFramedClientWithError(this.port); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithErrorMuti() throws TException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithErrorParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithError() throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + this.nonBlockClientWithError(this.port); + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithErrorMuti() + throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithError() throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + this.nonBlockClientWithError(this.port); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithErrorMuti() + throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithErrorParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithError() throws TException { + this.startSyncNonblockingServer(this.port); + this.syncFramedClientWithError(this.port); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithErrorMuti() throws TException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithErrorParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerWithError() throws TException { + this.startSyncHsHaServer(this.port); + this.syncFramedClientWithError(this.port); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerWithErrorMuti() throws TException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerWithErrorParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithError() throws TException { + this.startAsyncNonblockingServer(this.port); + this.syncFramedClientWithError(this.port); + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithErrorMuti() throws TException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithError() throws TException { + this.startAsyncHsHaServer(this.port); + this.syncFramedClientWithError(this.port); + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithErrorMuti() throws TException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithError(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithError(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsyncWithError("withError", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithError() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + this.nonBlockClientWithError(this.port); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithErrorMuti() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithErrorParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerWithError() throws TException, IOException { + this.startSyncHsHaServer(this.port); + this.nonBlockClientWithError(this.port); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 1); + } + + @Test + public void nonBlockMultiClientSyncHsHaServerMultiWithError() throws TException, IOException { + this.startMultiSyncHsHaServer(this.port); + this.nonBlockClientMultiWithError(this.port); + this.waitAndAssertTracesClientAsyncServerSyncWithError( + "withError", "syncHelloWorld:withError", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerWithErrorMuti() throws TException, IOException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerWithErrorParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSyncWithError("withError", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerWithErrorError() { + Exception error = null; + try { + this.startAsyncNonblockingServer(this.port); + this.syncClientWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServer("withError", 1); + } + + @Test + public void syncClientSyncNonblockingServerWithErrorError() { + Exception error = null; + try { + this.startSyncNonblockingServer(this.port); + this.syncClientWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServer("withError", 1); + } + + @Test + public void syncClientAsyncHsHaServerWithErrorError() { + Exception error = null; + try { + this.startAsyncHsHaServer(this.port); + this.syncClientWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServer("withError", 1); + } + + @Test + public void syncClientSyncHsHaServerWithErrorError() { + Exception error = null; + try { + this.startSyncHsHaServer(this.port); + this.syncClientWithError(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNull(); + this.waitAndAssertTracesClientSyncNoServer("withError", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithError() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + this.nonBlockClientWithError(this.port); + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithErrorMuti() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithError() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + this.nonBlockClientWithError(this.port); + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithErrorMuti() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithError(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithErrorParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithError(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerWithErrorParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsyncWithError("withError", threadCount); + } + + public void syncClientWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncClientMultiWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientWithError(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.withError_call s) { + try { + String result = s.getResult(); + Assertions.assertThat(result).isEqualTo("Hello USs' Bob"); + } catch (TException e) { + throw new VerifyException(e); + } + } + + @Override + public void onError(Exception e) { + Assertions.assertThat(e.getCause().getMessage()) + .isEqualTo("Read call frame size failed"); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.withError(callback)); + } + + public void nonBlockClientMultiWithError(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + TMultiplexedProtocolFactory multiplexedProtocolFactory = + new TMultiplexedProtocolFactory(protocolFactory, "syncHelloWorld"); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, multiplexedProtocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.withError_call s) { + try { + String result = s.getResult(); + Assertions.assertThat(result).isEqualTo("Hello USs' Bob"); + } catch (TException e) { + throw new VerifyException(e); + } + } + + @Override + public void onError(Exception e) { + Assertions.assertThat(e.getCause().getMessage()) + .isEqualTo("Read call frame size failed"); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.withError(callback)); + } + + public void syncFramedClientWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFramedClientMultiWithError(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientWithError(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withError()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/WithStructTest.java b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/WithStructTest.java new file mode 100644 index 000000000000..b130d4ece37b --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/WithStructTest.java @@ -0,0 +1,1014 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_3; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_9_3.thrift.Account; +import io.opentelemetry.instrumentation.thrift.v0_9_3.thrift.ThriftService; +import io.opentelemetry.instrumentation.thrift.v0_9_3.thrift.User; +import io.opentelemetry.instrumentation.thrift.v0_9_3.thrift.UserAccount; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class WithStructTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerWithStruct() throws TException { + this.startSyncSimpleServer(this.port); + this.syncClientWithStruct(this.port); + this.waitAndAssertTracesClientSyncServerSync("data", 1); + } + + @Test + public void syncClientSyncSimpleServerWithStructMuti() throws TException { + this.startSyncSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithStruct(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("data", 5); + } + + @Test + public void syncClientSyncSimpleServerWithStructParallel() + throws TException, InterruptedException { + this.startSyncSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithStruct(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerWithStruct() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientWithStruct(port); + this.waitAndAssertTracesClientSyncServerSync("data", 1); + } + + @Test + public void syncClientSyncThreadPoolServerWithStructMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithStruct(port); + } + this.waitAndAssertTracesClientSyncServerSync("data", 5); + } + + @Test + public void syncClientSyncThreadPoolServerWithStructParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithStruct(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerWithStruct() throws TException { + this.startMultiSimpleServer(this.port); + this.syncClientMultiWithStruct(this.port); + this.waitAndAssertTracesClientSyncServerSync("data", "syncHelloWorld:data", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerWithStructMuti() throws TException { + this.startMultiSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiWithStruct(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("data", "syncHelloWorld:data", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerWithStructParallel() + throws TException, InterruptedException { + this.startMultiSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiWithStruct(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", "syncHelloWorld:data", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerWithStructError() { + Exception error = null; + try { + this.startSyncThreadedSelectorServer(this.port); + this.syncClientWithStruct(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("data", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerWithStructError() { + Exception error = null; + try { + this.startAsyncThreadedSelectorServer(this.port); + this.syncClientWithStruct(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("data", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithStruct() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + this.syncFramedClientWithStruct(this.port); + this.waitAndAssertTracesClientSyncServerAsync("data", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithStructMuti() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("data", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithStructParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithStruct(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("data", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithStruct() throws TException { + this.startMultiThreadedSelectorServer(this.port); + this.syncFramedClientMultiWithStruct(this.port); + this.waitAndAssertTracesClientSyncServerSync("data", "syncHelloWorld:data", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithStructMuti() throws TException { + this.startMultiThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiWithStruct(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("data", "syncHelloWorld:data", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithStructParallel() + throws TException, InterruptedException { + this.startMultiThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiWithStruct(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", "syncHelloWorld:data", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithStruct() throws TException { + this.startSyncThreadedSelectorServer(this.port); + this.syncFramedClientWithStruct(this.port); + this.waitAndAssertTracesClientSyncServerSync("data", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithStructMuti() throws TException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("data", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithStructParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithStruct(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithStruct() throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + this.nonBlockClientWithStruct(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("data", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithStructMuti() + throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("data", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithStructParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithStruct(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("data", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithStruct() throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + this.nonBlockClientWithStruct(this.port); + this.waitAndAssertTracesClientAsyncServerSync("data", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithStructMuti() + throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("data", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithStructParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithStruct(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("data", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithStruct() throws TException { + this.startSyncNonblockingServer(this.port); + this.syncFramedClientWithStruct(this.port); + this.waitAndAssertTracesClientSyncServerSync("data", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithStructMuti() throws TException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("data", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithStructParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithStruct(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerWithStruct() throws TException { + this.startSyncHsHaServer(this.port); + this.syncFramedClientWithStruct(this.port); + this.waitAndAssertTracesClientSyncServerSync("data", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerWithStructMuti() throws TException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("data", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerWithStructParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithStruct(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("data", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithStruct() throws TException { + this.startAsyncNonblockingServer(this.port); + this.syncFramedClientWithStruct(this.port); + this.waitAndAssertTracesClientSyncServerAsync("data", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithStructMuti() throws TException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("data", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithStructParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithStruct(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("data", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithStruct() throws TException { + this.startAsyncHsHaServer(this.port); + this.syncFramedClientWithStruct(this.port); + this.waitAndAssertTracesClientSyncServerAsync("data", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithStructMuti() throws TException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("data", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithStructParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithStruct(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("data", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithStruct() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + this.nonBlockClientWithStruct(this.port); + this.waitAndAssertTracesClientAsyncServerSync("data", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithStructMuti() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("data", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithStructParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithStruct(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("data", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerWithStruct() throws TException, IOException { + this.startSyncHsHaServer(this.port); + this.nonBlockClientWithStruct(this.port); + this.waitAndAssertTracesClientAsyncServerSync("data", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerWithStructMuti() throws TException, IOException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("data", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerWithStructParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithStruct(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("data", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerWithStructError() { + Exception error = null; + try { + this.startAsyncNonblockingServer(this.port); + this.syncClientWithStruct(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("data", 1); + } + + @Test + public void syncClientSyncNonblockingServerWithStructError() { + Exception error = null; + try { + this.startSyncNonblockingServer(this.port); + this.syncClientWithStruct(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("data", 1); + } + + @Test + public void syncClientAsyncHsHaServerWithStructError() { + Exception error = null; + try { + this.startAsyncHsHaServer(this.port); + this.syncClientWithStruct(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("data", 1); + } + + @Test + public void syncClientSyncHsHaServerWithStructError() { + Exception error = null; + try { + this.startSyncHsHaServer(this.port); + this.syncClientWithStruct(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("data", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithStruct() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + this.nonBlockClientWithStruct(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("data", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithStructMuti() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("data", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithStructParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithStruct(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("data", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithStruct() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + this.nonBlockClientWithStruct(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("data", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithStructMuti() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithStruct(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("data", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithStructParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithStruct(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerWithStructParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("data", threadCount); + } + + public void syncClientWithStruct(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + UserAccount response = this.testing().runWithSpan("parent", () -> client.data(user, account)); + Assertions.assertThat(response.user).isEqualTo(user); + Assertions.assertThat(response.account).isEqualTo(account); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncClientMultiWithStruct(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + UserAccount response = this.testing().runWithSpan("parent", () -> client.data(user, account)); + Assertions.assertThat(response.user).isEqualTo(user); + Assertions.assertThat(response.account).isEqualTo(account); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientWithStruct(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.data_call response) { + try { + UserAccount result = response.getResult(); + Assertions.assertThat(result.user).isEqualTo(user); + Assertions.assertThat(result.account).isEqualTo(account); + } catch (TException e) { + throw new VerifyException(e); + } + } + + @Override + public void onError(Exception e) { + Assertions.assertThat(e.getCause().getMessage()) + .isEqualTo("Read call frame size failed"); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.data(user, account, callback)); + } + + public void syncFramedClientWithStruct(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + UserAccount response = this.testing().runWithSpan("parent", () -> client.data(user, account)); + Assertions.assertThat(response.user).isEqualTo(user); + Assertions.assertThat(response.account).isEqualTo(account); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFramedClientMultiWithStruct(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + UserAccount response = this.testing().runWithSpan("parent", () -> client.data(user, account)); + Assertions.assertThat(response.user).isEqualTo(user); + Assertions.assertThat(response.account).isEqualTo(account); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientWithStruct(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + User user = new User("Bob", "1", 20); + Account account = new Account("US", "123456"); + UserAccount response = this.testing().runWithSpan("parent", () -> client.data(user, account)); + Assertions.assertThat(response.user).isEqualTo(user); + Assertions.assertThat(response.account).isEqualTo(account); + } +} diff --git a/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/WithoutArgsTest.java b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/WithoutArgsTest.java new file mode 100644 index 000000000000..b0c2aa7123cc --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/WithoutArgsTest.java @@ -0,0 +1,1000 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_3; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_9_3.thrift.ThriftService; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import javax.security.sasl.Sasl; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.async.TAsyncClientManager; +import org.apache.thrift.protocol.TBinaryProtocol; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TFramedTransport; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TNonblockingTransport; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class WithoutArgsTest extends ThriftBaseTest { + + @Test + public void syncClientSyncSimpleServerWithoutArgs() throws TException { + this.startSyncSimpleServer(this.port); + this.syncClientWithoutArgs(this.port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 1); + } + + @Test + public void syncClientSyncSimpleServerWithoutArgsMuti() throws TException { + this.startSyncSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithoutArgs(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 5); + } + + @Test + public void syncClientSyncSimpleServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startSyncSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithoutArgs(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncClientSyncThreadPoolServerWithoutArgs() throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + this.syncClientWithoutArgs(port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 1); + } + + @Test + public void syncClientSyncThreadPoolServerWithoutArgsMuti() throws TException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + for (int i = 0; i < 5; ++i) { + this.syncClientWithoutArgs(port); + } + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 5); + } + + @Test + public void syncClientSyncThreadPoolServerWithoutArgsParallel() + throws TException, InterruptedException { + int port = super.getPort(); + this.startSyncThreadPoolServer(port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientWithoutArgs(port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncClientMutiSyncSimpleServerWithoutArgs() throws TException { + this.startMultiSimpleServer(this.port); + this.syncClientMultiWithoutArgs(this.port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", "syncHelloWorld:withoutArgs", 1); + } + + @Test + public void syncClientMutiSyncSimpleServerWithoutArgsMuti() throws TException { + this.startMultiSimpleServer(this.port); + for (int i = 0; i < 5; ++i) { + this.syncClientMultiWithoutArgs(this.port); + } + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", "syncHelloWorld:withoutArgs", 5); + } + + @Test + public void syncClientMutiSyncSimpleServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startMultiSimpleServer(this.port); + AtomicInteger count = new AtomicInteger(0); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncClientMultiWithoutArgs(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncClientSimpleServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + latch.await(); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "withoutArgs", "syncHelloWorld:withoutArgs", threadCount); + } + + @Test + public void syncClientSyncThreadedSelectorServerWithoutArgsError() { + Exception error = null; + try { + this.startSyncThreadedSelectorServer(this.port); + this.syncClientWithoutArgs(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withoutArgs", 1); + } + + @Test + public void syncClientAsyncThreadedSelectorServerWithoutArgsError() { + Exception error = null; + try { + this.startAsyncThreadedSelectorServer(this.port); + this.syncClientWithoutArgs(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withoutArgs", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithoutArgs() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + this.syncFramedClientWithoutArgs(this.port); + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", 1); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithoutArgsMuti() throws TException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", 5); + } + + @Test + public void syncFramedClientAsyncThreadedSelectorServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithoutArgs(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", threadCount); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithoutArgs() throws TException { + this.startMultiThreadedSelectorServer(this.port); + this.syncFramedClientMultiWithoutArgs(this.port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", "syncHelloWorld:withoutArgs", 1); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithoutArgsMuti() throws TException { + this.startMultiThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientMultiWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", "syncHelloWorld:withoutArgs", 5); + } + + @Test + public void syncFramedClientAsyncMutiThreadedSelectorServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startMultiThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientMultiWithoutArgs(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncThreadedSelectorServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync( + "withoutArgs", "syncHelloWorld:withoutArgs", threadCount); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithoutArgs() throws TException { + this.startSyncThreadedSelectorServer(this.port); + this.syncFramedClientWithoutArgs(this.port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 1); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithoutArgsMuti() throws TException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 5); + } + + @Test + public void syncFramedClientSyncThreadedSelectorServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithoutArgs(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncThreadedSelectorServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", threadCount); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithoutArgs() + throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + this.nonBlockClientWithoutArgs(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", 1); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithoutArgsMuti() + throws TException, IOException { + this.startAsyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", 5); + } + + @Test + public void nonBlockClientAsyncThreadedSelectorServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startAsyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithoutArgs(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncThreadedSelectorServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", threadCount); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithoutArgs() throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + this.nonBlockClientWithoutArgs(this.port); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 1); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithoutArgsMuti() + throws TException, IOException { + this.startSyncThreadedSelectorServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 5); + } + + @Test + public void nonBlockClientSyncThreadedSelectorServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startSyncThreadedSelectorServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithoutArgs(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncThreadedSelectorServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithoutArgs() throws TException { + this.startSyncNonblockingServer(this.port); + this.syncFramedClientWithoutArgs(this.port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 1); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithoutArgsMuti() throws TException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 5); + } + + @Test + public void syncFramedClientSyncNonblockingServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithoutArgs(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncNonblockingServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncFramedClientSyncHsHaServerWithoutArgs() throws TException { + this.startSyncHsHaServer(this.port); + this.syncFramedClientWithoutArgs(this.port); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 1); + } + + @Test + public void syncFramedClientSyncHsHaServerWithoutArgsMuti() throws TException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", 5); + } + + @Test + public void syncFramedClientSyncHsHaServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithoutArgs(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientSyncHsHaServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithoutArgs() throws TException { + this.startAsyncNonblockingServer(this.port); + this.syncFramedClientWithoutArgs(this.port); + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", 1); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithoutArgsMuti() throws TException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", 5); + } + + @Test + public void syncFramedClientAsyncNonblockingServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithoutArgs(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncNonblockingServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", threadCount); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithoutArgs() throws TException { + this.startAsyncHsHaServer(this.port); + this.syncFramedClientWithoutArgs(this.port); + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", 1); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithoutArgsMuti() throws TException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.syncFramedClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", 5); + } + + @Test + public void syncFramedClientAsyncHsHaServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.syncFramedClientWithoutArgs(this.port); + } catch (TException e) { + count.incrementAndGet(); + Assertions.fail( + "syncFramedClientAsyncHsHaServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientSyncServerAsync("withoutArgs", threadCount); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithoutArgs() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + this.nonBlockClientWithoutArgs(this.port); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 1); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithoutArgsMuti() throws TException, IOException { + this.startSyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 5); + } + + @Test + public void nonBlockClientSyncNonblockingServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startSyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithoutArgs(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncNonblockingServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", threadCount); + } + + @Test + public void nonBlockClientSyncHsHaServerWithoutArgs() throws TException, IOException { + this.startSyncHsHaServer(this.port); + this.nonBlockClientWithoutArgs(this.port); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 1); + } + + @Test + public void nonBlockClientSyncHsHaServerWithoutArgsMuti() throws TException, IOException { + this.startSyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", 5); + } + + @Test + public void nonBlockClientSyncHsHaServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startSyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithoutArgs(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientSyncHsHaServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerSync("withoutArgs", threadCount); + } + + @Test + public void syncClientAsyncNonblockingServerWithoutArgsError() { + Exception error = null; + try { + this.startAsyncNonblockingServer(this.port); + this.syncClientWithoutArgs(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withoutArgs", 1); + } + + @Test + public void syncClientSyncNonblockingServerWithoutArgsError() { + Exception error = null; + try { + this.startSyncNonblockingServer(this.port); + this.syncClientWithoutArgs(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withoutArgs", 1); + } + + @Test + public void syncClientAsyncHsHaServerWithoutArgsError() { + Exception error = null; + try { + this.startAsyncHsHaServer(this.port); + this.syncClientWithoutArgs(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withoutArgs", 1); + } + + @Test + public void syncClientSyncHsHaServerWithoutArgsError() { + Exception error = null; + try { + this.startSyncHsHaServer(this.port); + this.syncClientWithoutArgs(this.port); + } catch (TException e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + this.waitAndAssertTracesClientSyncNoServer("withoutArgs", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithoutArgs() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + this.nonBlockClientWithoutArgs(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", 1); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithoutArgsMuti() throws TException, IOException { + this.startAsyncNonblockingServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", 5); + } + + @Test + public void nonBlockClientAsyncNonblockingServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startAsyncNonblockingServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithoutArgs(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncNonblockingServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", threadCount); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithoutArgs() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + this.nonBlockClientWithoutArgs(this.port); + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", 1); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithoutArgsMuti() throws TException, IOException { + this.startAsyncHsHaServer(this.port); + + for (int i = 0; i < 5; ++i) { + this.nonBlockClientWithoutArgs(this.port); + } + + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", 5); + } + + @Test + public void nonBlockClientAsyncHsHaServerWithoutArgsParallel() + throws TException, InterruptedException { + this.startAsyncHsHaServer(this.port); + AtomicInteger count = new AtomicInteger(); + int threadCount = 5; + CountDownLatch latch = new CountDownLatch(threadCount); + + for (int i = 0; i < threadCount; ++i) { + new Thread( + () -> { + try { + this.nonBlockClientWithoutArgs(this.port); + } catch (IOException | TException e) { + count.incrementAndGet(); + Assertions.fail( + "nonBlockClientAsyncHsHaServerWithoutArgsParallel field: " + + e.getCause().getMessage()); + } finally { + latch.countDown(); + } + }) + .start(); + } + + latch.await(10L, TimeUnit.SECONDS); + Assertions.assertThat(count.get()).isEqualTo(0); + this.waitAndAssertTracesClientAsyncServerAsync("withoutArgs", threadCount); + } + + public void syncClientWithoutArgs(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.withoutArgs()); + Assertions.assertThat(response).isEqualTo("no args"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncClientMultiWithoutArgs(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + transport.open(); + TProtocol protocol = new TBinaryProtocol(transport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + String response = this.testing().runWithSpan("parent", () -> client.withoutArgs()); + Assertions.assertThat(response).isEqualTo("no args"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void nonBlockClientWithoutArgs(int port) throws TException, IOException { + TNonblockingTransport transport = new TNonblockingSocket("localhost", port); + TAsyncClientManager clientManager = new TAsyncClientManager(); + TProtocolFactory protocolFactory = new TBinaryProtocol.Factory(); + ThriftService.AsyncClient.Factory factory = + new ThriftService.AsyncClient.Factory(clientManager, protocolFactory); + ThriftService.AsyncClient asyClient = factory.getAsyncClient(transport); + AsyncMethodCallback callback = + new AsyncMethodCallback() { + @Override + public void onComplete(ThriftService.AsyncClient.withoutArgs_call s) { + try { + String result = s.getResult(); + Assertions.assertThat(result).isEqualTo("no args"); + } catch (TException e) { + throw new VerifyException(e); + } + } + + @Override + public void onError(Exception e) { + Assertions.assertThat(e.getCause().getMessage()) + .isEqualTo("Read call frame size failed"); + } + }; + this.testing().runWithSpan("parent", () -> asyClient.withoutArgs(callback)); + } + + public void syncFramedClientWithoutArgs(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + ThriftService.Client client = new ThriftService.Client(protocol); + String response = this.testing().runWithSpan("parent", () -> client.withoutArgs()); + Assertions.assertThat(response).isEqualTo("no args"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncFramedClientMultiWithoutArgs(int port) throws TException { + TTransport transport = null; + try { + transport = new TSocket("localhost", port); + TFramedTransport framedTransport = new TFramedTransport(transport); + framedTransport.open(); + TProtocol protocol = new TBinaryProtocol(framedTransport); + TMultiplexedProtocol multiplexedProtocol = + new TMultiplexedProtocol(protocol, "syncHelloWorld"); + ThriftService.Client client = new ThriftService.Client(multiplexedProtocol); + String response = this.testing().runWithSpan("parent", () -> client.withoutArgs()); + Assertions.assertThat(response).isEqualTo("no args"); + } finally { + if (transport != null) { + transport.close(); + } + } + } + + public void syncNonblockingSaslClientWithoutArgs(int port) throws TException, IOException { + Map saslOptions = new HashMap(); + saslOptions.put(Sasl.QOP, "auth"); + saslOptions.put(Sasl.SERVER_AUTH, "true"); + TNonblockingTransport nonblockingTransport = new TNonblockingSocket("localhost", port); + TTransport transport = + new TSaslClientTransport( + "PLAIN", // SASL 机制 + null, // Authorization ID + null, // Authentication ID (用户名) + null, // Password + saslOptions, // SASL properties + new TestSaslCallbackHandler("12345"), // Callback handler + nonblockingTransport // 底层传输 + ); + TProtocol protocol = new TBinaryProtocol(transport); + ThriftService.Client client = new ThriftService.Client(protocol); + Exception error = null; + try { + this.testing().runWithSpan("parent", () -> client.withoutArgs()); + } catch (Exception e) { + error = e; + } + Assertions.assertThat(error).isNotNull(); + } +} diff --git a/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/common/TMultiplexedProtocolFactory.java b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/common/TMultiplexedProtocolFactory.java new file mode 100644 index 000000000000..6674ff0603a4 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/common/TMultiplexedProtocolFactory.java @@ -0,0 +1,28 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_3.common; + +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TProtocol; +import org.apache.thrift.protocol.TProtocolFactory; +import org.apache.thrift.transport.TTransport; + +@SuppressWarnings("all") +public class TMultiplexedProtocolFactory implements TProtocolFactory { + private final TProtocolFactory protocolFactory; + private final String serviceName; + + public TMultiplexedProtocolFactory(TProtocolFactory protocolFactory, String serviceName) { + this.protocolFactory = protocolFactory; + this.serviceName = serviceName; + } + + @Override + public TProtocol getProtocol(TTransport trans) { + TProtocol baseProtocol = protocolFactory.getProtocol(trans); + return new TMultiplexedProtocol(baseProtocol, serviceName); + } +} diff --git a/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/server/ThriftServiceAsyncImpl.java b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/server/ThriftServiceAsyncImpl.java new file mode 100644 index 000000000000..0fd87bf6d0bf --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/server/ThriftServiceAsyncImpl.java @@ -0,0 +1,75 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_3.server; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_9_3.thrift.Account; +import io.opentelemetry.instrumentation.thrift.v0_9_3.thrift.ThriftService; +import io.opentelemetry.instrumentation.thrift.v0_9_3.thrift.User; +import io.opentelemetry.instrumentation.thrift.v0_9_3.thrift.UserAccount; +import java.util.concurrent.TimeUnit; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused", "all"}) +public class ThriftServiceAsyncImpl implements ThriftService.AsyncIface { + public ThriftServiceAsyncImpl() {} + + @Override + public void sayHello(String zone, String name, AsyncMethodCallback resultHandler) + throws TException { + resultHandler.onComplete("Hello " + zone + "s' " + name); + } + + @Override + public void withDelay(int delay, AsyncMethodCallback resultHandler) throws TException { + try { + TimeUnit.SECONDS.sleep(delay); + } catch (InterruptedException var4) { + InterruptedException e = var4; + throw new VerifyException(e); + } + + resultHandler.onComplete("delay " + delay); + } + + @Override + public void withoutArgs(AsyncMethodCallback resultHandler) throws TException { + resultHandler.onComplete("no args"); + } + + @Override + public void withError(AsyncMethodCallback resultHandler) throws TException { + throw new VerifyException("fail"); + } + + @Override + public void withCollisioin(String input, AsyncMethodCallback resultHandler) throws TException { + resultHandler.onComplete(input); + } + + @Override + public void noReturn(int delay, AsyncMethodCallback resultHandler) throws TException { + resultHandler.onComplete(null); + } + + @Override + public void oneWayHasArgs(int delay, AsyncMethodCallback resultHandler) throws TException {} + + @Override + public void oneWay(AsyncMethodCallback resultHandler) throws TException {} + + @Override + public void oneWayWithError(AsyncMethodCallback resultHandler) throws TException { + throw new VerifyException("fail"); + } + + @Override + public void data(User user, Account account, AsyncMethodCallback resultHandler) + throws TException { + resultHandler.onComplete(new UserAccount(user, account)); + } +} diff --git a/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/server/ThriftServiceImpl.java b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/server/ThriftServiceImpl.java new file mode 100644 index 000000000000..2610882f7ad4 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/server/ThriftServiceImpl.java @@ -0,0 +1,71 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_3.server; + +import com.google.common.base.VerifyException; +import io.opentelemetry.instrumentation.thrift.v0_9_3.thrift.Account; +import io.opentelemetry.instrumentation.thrift.v0_9_3.thrift.ThriftService; +import io.opentelemetry.instrumentation.thrift.v0_9_3.thrift.User; +import io.opentelemetry.instrumentation.thrift.v0_9_3.thrift.UserAccount; +import java.util.concurrent.TimeUnit; +import org.apache.thrift.TException; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused", "all"}) +public class ThriftServiceImpl implements ThriftService.Iface { + + public ThriftServiceImpl() {} + + @Override + public String sayHello(String zone, String name) { + return "Hello " + zone + "s' " + name; + } + + @Override + public String withDelay(int delay) { + try { + TimeUnit.SECONDS.sleep((long) delay); + } catch (InterruptedException var3) { + InterruptedException e = var3; + throw new VerifyException(e); + } + + return "delay " + delay; + } + + @Override + public String withoutArgs() { + return "no args"; + } + + @Override + public String withError() { + throw new VerifyException("fail"); + } + + @Override + public String withCollisioin(String input) { + return input; + } + + @Override + public void noReturn(int delay) throws TException {} + + @Override + public void oneWayHasArgs(int delay) throws TException {} + + @Override + public void oneWay() {} + + @Override + public void oneWayWithError() { + throw new VerifyException("fail"); + } + + @Override + public UserAccount data(User user, Account account) { + return new UserAccount(user, account); + } +} diff --git a/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/thrift/Account.java b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/thrift/Account.java new file mode 100644 index 000000000000..00d975266e70 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/thrift/Account.java @@ -0,0 +1,492 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_3.thrift; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "all"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2025-02-27") +public class Account + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("Account"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField CARD_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "cardId", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new AccountStandardSchemeFactory()); + schemes.put(TupleScheme.class, new AccountTupleSchemeFactory()); + } + + public String zone; // required + public String cardId; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + CARD_ID((short) 2, "cardId"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // CARD_ID + return CARD_ID; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.CARD_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "cardId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Account.class, metaDataMap); + } + + public Account() {} + + public Account(String zone, String cardId) { + this(); + this.zone = zone; + this.cardId = cardId; + } + + /** Performs a deep copy on other. */ + public Account(Account other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetCardId()) { + this.cardId = other.cardId; + } + } + + public Account deepCopy() { + return new Account(this); + } + + @Override + public void clear() { + this.zone = null; + this.cardId = null; + } + + public String getZone() { + return this.zone; + } + + public Account setZone(String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + public String getCardId() { + return this.cardId; + } + + public Account setCardId(String cardId) { + this.cardId = cardId; + return this; + } + + public void unsetCardId() { + this.cardId = null; + } + + /** Returns true if field cardId is set (has been assigned a value) and false otherwise */ + public boolean isSetCardId() { + return this.cardId != null; + } + + public void setCardIdIsSet(boolean value) { + if (!value) { + this.cardId = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((String) value); + } + break; + + case CARD_ID: + if (value == null) { + unsetCardId(); + } else { + setCardId((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case CARD_ID: + return getCardId(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case CARD_ID: + return isSetCardId(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof Account) return this.equals((Account) that); + return false; + } + + public boolean equals(Account that) { + if (that == null) return false; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_cardId = true && this.isSetCardId(); + boolean that_present_cardId = true && that.isSetCardId(); + if (this_present_cardId || that_present_cardId) { + if (!(this_present_cardId && that_present_cardId)) return false; + if (!this.cardId.equals(that.cardId)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_zone = true && (isSetZone()); + list.add(present_zone); + if (present_zone) list.add(zone); + + boolean present_cardId = true && (isSetCardId()); + list.add(present_cardId); + if (present_cardId) list.add(cardId); + + return list.hashCode(); + } + + @Override + public int compareTo(Account other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetZone()).compareTo(other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetCardId()).compareTo(other.isSetCardId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCardId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cardId, other.cardId); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("Account("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("cardId:"); + if (this.cardId == null) { + sb.append("null"); + } else { + sb.append(this.cardId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (zone == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'zone' was not present! Struct: " + toString()); + } + if (cardId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'cardId' was not present! Struct: " + toString()); + } + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class AccountStandardSchemeFactory implements SchemeFactory { + public AccountStandardScheme getScheme() { + return new AccountStandardScheme(); + } + } + + private static class AccountStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // CARD_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, Account struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.cardId != null) { + oprot.writeFieldBegin(CARD_ID_FIELD_DESC); + oprot.writeString(struct.cardId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class AccountTupleSchemeFactory implements SchemeFactory { + public AccountTupleScheme getScheme() { + return new AccountTupleScheme(); + } + } + + private static class AccountTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeString(struct.zone); + oprot.writeString(struct.cardId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/thrift/ThriftService.java b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/thrift/ThriftService.java new file mode 100644 index 000000000000..2bb7e9851a38 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/thrift/ThriftService.java @@ -0,0 +1,7532 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_3.thrift; + +import java.util.ArrayList; +import java.util.BitSet; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "all"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2025-02-27") +public class ThriftService { + + public interface Iface { + + public String sayHello(String zone, String name) throws TException; + + public String withDelay(int delay) throws TException; + + public String withoutArgs() throws TException; + + public String withError() throws TException; + + public String withCollisioin(String input) throws TException; + + public void noReturn(int delay) throws TException; + + public void oneWayHasArgs(int delay) throws TException; + + public void oneWay() throws TException; + + public void oneWayWithError() throws TException; + + public UserAccount data(User user, Account account) throws TException; + } + + public interface AsyncIface { + + public void sayHello(String zone, String name, AsyncMethodCallback resultHandler) + throws TException; + + public void withDelay(int delay, AsyncMethodCallback resultHandler) throws TException; + + public void withoutArgs(AsyncMethodCallback resultHandler) throws TException; + + public void withError(AsyncMethodCallback resultHandler) throws TException; + + public void withCollisioin(String input, AsyncMethodCallback resultHandler) throws TException; + + public void noReturn(int delay, AsyncMethodCallback resultHandler) throws TException; + + public void oneWayHasArgs(int delay, AsyncMethodCallback resultHandler) throws TException; + + public void oneWay(AsyncMethodCallback resultHandler) throws TException; + + public void oneWayWithError(AsyncMethodCallback resultHandler) throws TException; + + public void data(User user, Account account, AsyncMethodCallback resultHandler) + throws TException; + } + + public static class Client extends org.apache.thrift.TServiceClient implements Iface { + public static class Factory implements org.apache.thrift.TServiceClientFactory { + public Factory() {} + + public Client getClient(org.apache.thrift.protocol.TProtocol prot) { + return new Client(prot); + } + + public Client getClient( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + return new Client(iprot, oprot); + } + } + + public Client(org.apache.thrift.protocol.TProtocol prot) { + super(prot, prot); + } + + public Client( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + super(iprot, oprot); + } + + public String sayHello(String zone, String name) throws TException { + send_sayHello(zone, name); + return recv_sayHello(); + } + + public void send_sayHello(String zone, String name) throws TException { + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + sendBase("sayHello", args); + } + + public String recv_sayHello() throws TException { + sayHello_result result = new sayHello_result(); + receiveBase(result, "sayHello"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "sayHello failed: unknown result"); + } + + public String withDelay(int delay) throws TException { + send_withDelay(delay); + return recv_withDelay(); + } + + public void send_withDelay(int delay) throws TException { + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + sendBase("withDelay", args); + } + + public String recv_withDelay() throws TException { + withDelay_result result = new withDelay_result(); + receiveBase(result, "withDelay"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withDelay failed: unknown result"); + } + + public String withoutArgs() throws TException { + send_withoutArgs(); + return recv_withoutArgs(); + } + + public void send_withoutArgs() throws TException { + withoutArgs_args args = new withoutArgs_args(); + sendBase("withoutArgs", args); + } + + public String recv_withoutArgs() throws TException { + withoutArgs_result result = new withoutArgs_result(); + receiveBase(result, "withoutArgs"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withoutArgs failed: unknown result"); + } + + public String withError() throws TException { + send_withError(); + return recv_withError(); + } + + public void send_withError() throws TException { + withError_args args = new withError_args(); + sendBase("withError", args); + } + + public String recv_withError() throws TException { + withError_result result = new withError_result(); + receiveBase(result, "withError"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withError failed: unknown result"); + } + + public String withCollisioin(String input) throws TException { + send_withCollisioin(input); + return recv_withCollisioin(); + } + + public void send_withCollisioin(String input) throws TException { + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + sendBase("withCollisioin", args); + } + + public String recv_withCollisioin() throws TException { + withCollisioin_result result = new withCollisioin_result(); + receiveBase(result, "withCollisioin"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withCollisioin failed: unknown result"); + } + + public void noReturn(int delay) throws TException { + send_noReturn(delay); + recv_noReturn(); + } + + public void send_noReturn(int delay) throws TException { + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + sendBase("noReturn", args); + } + + public void recv_noReturn() throws TException { + noReturn_result result = new noReturn_result(); + receiveBase(result, "noReturn"); + return; + } + + public void oneWayHasArgs(int delay) throws TException { + send_oneWayHasArgs(delay); + } + + public void send_oneWayHasArgs(int delay) throws TException { + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + sendBaseOneway("oneWayHasArgs", args); + } + + public void oneWay() throws TException { + send_oneWay(); + } + + public void send_oneWay() throws TException { + oneWay_args args = new oneWay_args(); + sendBaseOneway("oneWay", args); + } + + public void oneWayWithError() throws TException { + send_oneWayWithError(); + } + + public void send_oneWayWithError() throws TException { + oneWayWithError_args args = new oneWayWithError_args(); + sendBaseOneway("oneWayWithError", args); + } + + public UserAccount data(User user, Account account) throws TException { + send_data(user, account); + return recv_data(); + } + + public void send_data(User user, Account account) throws TException { + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + sendBase("data", args); + } + + public UserAccount recv_data() throws TException { + data_result result = new data_result(); + receiveBase(result, "data"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, "data failed: unknown result"); + } + } + + public static class AsyncClient extends org.apache.thrift.async.TAsyncClient + implements AsyncIface { + public static class Factory + implements org.apache.thrift.async.TAsyncClientFactory { + private org.apache.thrift.async.TAsyncClientManager clientManager; + private org.apache.thrift.protocol.TProtocolFactory protocolFactory; + + public Factory( + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.protocol.TProtocolFactory protocolFactory) { + this.clientManager = clientManager; + this.protocolFactory = protocolFactory; + } + + public AsyncClient getAsyncClient( + org.apache.thrift.transport.TNonblockingTransport transport) { + return new AsyncClient(protocolFactory, clientManager, transport); + } + } + + public AsyncClient( + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.transport.TNonblockingTransport transport) { + super(protocolFactory, clientManager, transport); + } + + public void sayHello(String zone, String name, AsyncMethodCallback resultHandler) + throws TException { + checkReady(); + sayHello_call method_call = + new sayHello_call(zone, name, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class sayHello_call extends org.apache.thrift.async.TAsyncMethodCall { + private String zone; + private String name; + + public sayHello_call( + String zone, + String name, + AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + this.zone = zone; + this.name = name; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "sayHello", org.apache.thrift.protocol.TMessageType.CALL, 0)); + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_sayHello(); + } + } + + public void withDelay(int delay, AsyncMethodCallback resultHandler) throws TException { + checkReady(); + withDelay_call method_call = + new withDelay_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withDelay_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public withDelay_call( + int delay, + AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withDelay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withDelay(); + } + } + + public void withoutArgs(AsyncMethodCallback resultHandler) throws TException { + checkReady(); + withoutArgs_call method_call = + new withoutArgs_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withoutArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + public withoutArgs_call( + AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withoutArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withoutArgs_args args = new withoutArgs_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withoutArgs(); + } + } + + public void withError(AsyncMethodCallback resultHandler) throws TException { + checkReady(); + withError_call method_call = + new withError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withError_call extends org.apache.thrift.async.TAsyncMethodCall { + public withError_call( + AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withError_args args = new withError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withError(); + } + } + + public void withCollisioin(String input, AsyncMethodCallback resultHandler) throws TException { + checkReady(); + withCollisioin_call method_call = + new withCollisioin_call(input, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withCollisioin_call extends org.apache.thrift.async.TAsyncMethodCall { + private String input; + + public withCollisioin_call( + String input, + AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + this.input = input; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withCollisioin", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withCollisioin(); + } + } + + public void noReturn(int delay, AsyncMethodCallback resultHandler) throws TException { + checkReady(); + noReturn_call method_call = + new noReturn_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class noReturn_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public noReturn_call( + int delay, + AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "noReturn", org.apache.thrift.protocol.TMessageType.CALL, 0)); + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + (new Client(prot)).recv_noReturn(); + } + } + + public void oneWayHasArgs(int delay, AsyncMethodCallback resultHandler) throws TException { + checkReady(); + oneWayHasArgs_call method_call = + new oneWayHasArgs_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayHasArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public oneWayHasArgs_call( + int delay, + AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, true); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayHasArgs", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void oneWay(AsyncMethodCallback resultHandler) throws TException { + checkReady(); + oneWay_call method_call = + new oneWay_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWay_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWay_call( + AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWay", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWay_args args = new oneWay_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void oneWayWithError(AsyncMethodCallback resultHandler) throws TException { + checkReady(); + oneWayWithError_call method_call = + new oneWayWithError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayWithError_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWayWithError_call( + AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayWithError", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayWithError_args args = new oneWayWithError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void data(User user, Account account, AsyncMethodCallback resultHandler) + throws TException { + checkReady(); + data_call method_call = + new data_call(user, account, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class data_call extends org.apache.thrift.async.TAsyncMethodCall { + private User user; + private Account account; + + public data_call( + User user, + Account account, + AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + this.user = user; + this.account = account; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "data", org.apache.thrift.protocol.TMessageType.CALL, 0)); + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + args.write(prot); + prot.writeMessageEnd(); + } + + public UserAccount getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_data(); + } + } + } + + public static class Processor extends org.apache.thrift.TBaseProcessor + implements org.apache.thrift.TProcessor { + private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); + + public Processor(I iface) { + super( + iface, + getProcessMap( + new HashMap< + String, + org.apache.thrift.ProcessFunction>())); + } + + protected Processor( + I iface, + Map> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + Map> + getProcessMap( + Map> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.ProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + protected boolean isOneway() { + return false; + } + + public sayHello_result getResult(I iface, sayHello_args args) throws TException { + sayHello_result result = new sayHello_result(); + result.success = iface.sayHello(args.zone, args.name); + return result; + } + } + + public static class withDelay + extends org.apache.thrift.ProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + protected boolean isOneway() { + return false; + } + + public withDelay_result getResult(I iface, withDelay_args args) throws TException { + withDelay_result result = new withDelay_result(); + result.success = iface.withDelay(args.delay); + return result; + } + } + + public static class withoutArgs + extends org.apache.thrift.ProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + protected boolean isOneway() { + return false; + } + + public withoutArgs_result getResult(I iface, withoutArgs_args args) throws TException { + withoutArgs_result result = new withoutArgs_result(); + result.success = iface.withoutArgs(); + return result; + } + } + + public static class withError + extends org.apache.thrift.ProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + protected boolean isOneway() { + return false; + } + + public withError_result getResult(I iface, withError_args args) throws TException { + withError_result result = new withError_result(); + result.success = iface.withError(); + return result; + } + } + + public static class withCollisioin + extends org.apache.thrift.ProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + protected boolean isOneway() { + return false; + } + + public withCollisioin_result getResult(I iface, withCollisioin_args args) throws TException { + withCollisioin_result result = new withCollisioin_result(); + result.success = iface.withCollisioin(args.input); + return result; + } + } + + public static class noReturn + extends org.apache.thrift.ProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + protected boolean isOneway() { + return false; + } + + public noReturn_result getResult(I iface, noReturn_args args) throws TException { + noReturn_result result = new noReturn_result(); + iface.noReturn(args.delay); + return result; + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.ProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + protected boolean isOneway() { + return true; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayHasArgs_args args) throws TException { + iface.oneWayHasArgs(args.delay); + return null; + } + } + + public static class oneWay + extends org.apache.thrift.ProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + protected boolean isOneway() { + return true; + } + + public org.apache.thrift.TBase getResult(I iface, oneWay_args args) throws TException { + iface.oneWay(); + return null; + } + } + + public static class oneWayWithError + extends org.apache.thrift.ProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + protected boolean isOneway() { + return true; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayWithError_args args) + throws TException { + iface.oneWayWithError(); + return null; + } + } + + public static class data + extends org.apache.thrift.ProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + protected boolean isOneway() { + return false; + } + + public data_result getResult(I iface, data_args args) throws TException { + data_result result = new data_result(); + result.success = iface.data(args.user, args.account); + return result; + } + } + } + + public static class AsyncProcessor + extends org.apache.thrift.TBaseAsyncProcessor { + private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); + + public AsyncProcessor(I iface) { + super( + iface, + getProcessMap( + new HashMap< + String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>>())); + } + + protected AsyncProcessor( + I iface, + Map> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + Map> + getProcessMap( + Map< + String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.AsyncProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(String o) { + sayHello_result result = new sayHello_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + sayHello_result result = new sayHello_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, sayHello_args args, AsyncMethodCallback resultHandler) + throws TException { + iface.sayHello(args.zone, args.name, resultHandler); + } + } + + public static class withDelay + extends org.apache.thrift.AsyncProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(String o) { + withDelay_result result = new withDelay_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + withDelay_result result = new withDelay_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, withDelay_args args, AsyncMethodCallback resultHandler) + throws TException { + iface.withDelay(args.delay, resultHandler); + } + } + + public static class withoutArgs + extends org.apache.thrift.AsyncProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(String o) { + withoutArgs_result result = new withoutArgs_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + withoutArgs_result result = new withoutArgs_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, withoutArgs_args args, AsyncMethodCallback resultHandler) + throws TException { + iface.withoutArgs(resultHandler); + } + } + + public static class withError + extends org.apache.thrift.AsyncProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(String o) { + withError_result result = new withError_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + withError_result result = new withError_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, withError_args args, AsyncMethodCallback resultHandler) + throws TException { + iface.withError(resultHandler); + } + } + + public static class withCollisioin + extends org.apache.thrift.AsyncProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(String o) { + withCollisioin_result result = new withCollisioin_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + withCollisioin_result result = new withCollisioin_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, withCollisioin_args args, AsyncMethodCallback resultHandler) + throws TException { + iface.withCollisioin(args.input, resultHandler); + } + } + + public static class noReturn + extends org.apache.thrift.AsyncProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Void o) { + noReturn_result result = new noReturn_result(); + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + noReturn_result result = new noReturn_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, noReturn_args args, AsyncMethodCallback resultHandler) + throws TException { + iface.noReturn(args.delay, resultHandler); + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.AsyncProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(Exception e) {} + }; + } + + protected boolean isOneway() { + return true; + } + + public void start(I iface, oneWayHasArgs_args args, AsyncMethodCallback resultHandler) + throws TException { + iface.oneWayHasArgs(args.delay, resultHandler); + } + } + + public static class oneWay + extends org.apache.thrift.AsyncProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(Exception e) {} + }; + } + + protected boolean isOneway() { + return true; + } + + public void start(I iface, oneWay_args args, AsyncMethodCallback resultHandler) + throws TException { + iface.oneWay(resultHandler); + } + } + + public static class oneWayWithError + extends org.apache.thrift.AsyncProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(Exception e) {} + }; + } + + protected boolean isOneway() { + return true; + } + + public void start(I iface, oneWayWithError_args args, AsyncMethodCallback resultHandler) + throws TException { + iface.oneWayWithError(resultHandler); + } + } + + public static class data + extends org.apache.thrift.AsyncProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(UserAccount o) { + data_result result = new data_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + data_result result = new data_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, data_args args, AsyncMethodCallback resultHandler) + throws TException { + iface.data(args.user, args.account, resultHandler); + } + } + } + + public static class sayHello_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_args"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new sayHello_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new sayHello_argsTupleSchemeFactory()); + } + + public String zone; // required + public String name; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + NAME((short) 2, "name"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // NAME + return NAME; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_args.class, metaDataMap); + } + + public sayHello_args() {} + + public sayHello_args(String zone, String name) { + this(); + this.zone = zone; + this.name = name; + } + + /** Performs a deep copy on other. */ + public sayHello_args(sayHello_args other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetName()) { + this.name = other.name; + } + } + + public sayHello_args deepCopy() { + return new sayHello_args(this); + } + + @Override + public void clear() { + this.zone = null; + this.name = null; + } + + public String getZone() { + return this.zone; + } + + public sayHello_args setZone(String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + public String getName() { + return this.name; + } + + public sayHello_args setName(String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((String) value); + } + break; + + case NAME: + if (value == null) { + unsetName(); + } else { + setName((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case NAME: + return getName(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case NAME: + return isSetName(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof sayHello_args) return this.equals((sayHello_args) that); + return false; + } + + public boolean equals(sayHello_args that) { + if (that == null) return false; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_zone = true && (isSetZone()); + list.add(present_zone); + if (present_zone) list.add(zone); + + boolean present_name = true && (isSetName()); + list.add(present_name); + if (present_name) list.add(name); + + return list.hashCode(); + } + + @Override + public int compareTo(sayHello_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetZone()).compareTo(other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("sayHello_args("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_argsStandardSchemeFactory implements SchemeFactory { + public sayHello_argsStandardScheme getScheme() { + return new sayHello_argsStandardScheme(); + } + } + + private static class sayHello_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_argsTupleSchemeFactory implements SchemeFactory { + public sayHello_argsTupleScheme getScheme() { + return new sayHello_argsTupleScheme(); + } + } + + private static class sayHello_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetZone()) { + optionals.set(0); + } + if (struct.isSetName()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetZone()) { + oprot.writeString(struct.zone); + } + if (struct.isSetName()) { + oprot.writeString(struct.name); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } + if (incoming.get(1)) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } + } + } + } + + public static class sayHello_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new sayHello_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new sayHello_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_result.class, metaDataMap); + } + + public sayHello_result() {} + + public sayHello_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public sayHello_result(sayHello_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public sayHello_result deepCopy() { + return new sayHello_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public sayHello_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof sayHello_result) return this.equals((sayHello_result) that); + return false; + } + + public boolean equals(sayHello_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(sayHello_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("sayHello_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_resultStandardSchemeFactory implements SchemeFactory { + public sayHello_resultStandardScheme getScheme() { + return new sayHello_resultStandardScheme(); + } + } + + private static class sayHello_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_resultTupleSchemeFactory implements SchemeFactory { + public sayHello_resultTupleScheme getScheme() { + return new sayHello_resultTupleScheme(); + } + } + + private static class sayHello_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withDelay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withDelay_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withDelay_argsTupleSchemeFactory()); + } + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_args.class, metaDataMap); + } + + public withDelay_args() {} + + public withDelay_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public withDelay_args(withDelay_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public withDelay_args deepCopy() { + return new withDelay_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public withDelay_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withDelay_args) return this.equals((withDelay_args) that); + return false; + } + + public boolean equals(withDelay_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_delay = true; + list.add(present_delay); + if (present_delay) list.add(delay); + + return list.hashCode(); + } + + @Override + public int compareTo(withDelay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withDelay_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_argsStandardSchemeFactory implements SchemeFactory { + public withDelay_argsStandardScheme getScheme() { + return new withDelay_argsStandardScheme(); + } + } + + private static class withDelay_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_argsTupleSchemeFactory implements SchemeFactory { + public withDelay_argsTupleScheme getScheme() { + return new withDelay_argsTupleScheme(); + } + } + + private static class withDelay_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + } + + public static class withDelay_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withDelay_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withDelay_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_result.class, metaDataMap); + } + + public withDelay_result() {} + + public withDelay_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withDelay_result(withDelay_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withDelay_result deepCopy() { + return new withDelay_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withDelay_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withDelay_result) return this.equals((withDelay_result) that); + return false; + } + + public boolean equals(withDelay_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(withDelay_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withDelay_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_resultStandardSchemeFactory implements SchemeFactory { + public withDelay_resultStandardScheme getScheme() { + return new withDelay_resultStandardScheme(); + } + } + + private static class withDelay_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_resultTupleSchemeFactory implements SchemeFactory { + public withDelay_resultTupleScheme getScheme() { + return new withDelay_resultTupleScheme(); + } + } + + private static class withDelay_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withoutArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withoutArgs_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withoutArgs_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_args.class, metaDataMap); + } + + public withoutArgs_args() {} + + /** Performs a deep copy on other. */ + public withoutArgs_args(withoutArgs_args other) {} + + public withoutArgs_args deepCopy() { + return new withoutArgs_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withoutArgs_args) return this.equals((withoutArgs_args) that); + return false; + } + + public boolean equals(withoutArgs_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + return list.hashCode(); + } + + @Override + public int compareTo(withoutArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withoutArgs_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_argsStandardSchemeFactory implements SchemeFactory { + public withoutArgs_argsStandardScheme getScheme() { + return new withoutArgs_argsStandardScheme(); + } + } + + private static class withoutArgs_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_argsTupleSchemeFactory implements SchemeFactory { + public withoutArgs_argsTupleScheme getScheme() { + return new withoutArgs_argsTupleScheme(); + } + } + + private static class withoutArgs_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class withoutArgs_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withoutArgs_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withoutArgs_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_result.class, metaDataMap); + } + + public withoutArgs_result() {} + + public withoutArgs_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withoutArgs_result(withoutArgs_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withoutArgs_result deepCopy() { + return new withoutArgs_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withoutArgs_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withoutArgs_result) return this.equals((withoutArgs_result) that); + return false; + } + + public boolean equals(withoutArgs_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(withoutArgs_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withoutArgs_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_resultStandardSchemeFactory implements SchemeFactory { + public withoutArgs_resultStandardScheme getScheme() { + return new withoutArgs_resultStandardScheme(); + } + } + + private static class withoutArgs_resultStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_resultTupleSchemeFactory implements SchemeFactory { + public withoutArgs_resultTupleScheme getScheme() { + return new withoutArgs_resultTupleScheme(); + } + } + + private static class withoutArgs_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withError_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withError_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_args.class, metaDataMap); + } + + public withError_args() {} + + /** Performs a deep copy on other. */ + public withError_args(withError_args other) {} + + public withError_args deepCopy() { + return new withError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withError_args) return this.equals((withError_args) that); + return false; + } + + public boolean equals(withError_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + return list.hashCode(); + } + + @Override + public int compareTo(withError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_argsStandardSchemeFactory implements SchemeFactory { + public withError_argsStandardScheme getScheme() { + return new withError_argsStandardScheme(); + } + } + + private static class withError_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_argsTupleSchemeFactory implements SchemeFactory { + public withError_argsTupleScheme getScheme() { + return new withError_argsTupleScheme(); + } + } + + private static class withError_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class withError_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withError_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withError_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_result.class, metaDataMap); + } + + public withError_result() {} + + public withError_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withError_result(withError_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withError_result deepCopy() { + return new withError_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withError_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withError_result) return this.equals((withError_result) that); + return false; + } + + public boolean equals(withError_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(withError_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withError_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_resultStandardSchemeFactory implements SchemeFactory { + public withError_resultStandardScheme getScheme() { + return new withError_resultStandardScheme(); + } + } + + private static class withError_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_resultTupleSchemeFactory implements SchemeFactory { + public withError_resultTupleScheme getScheme() { + return new withError_resultTupleScheme(); + } + } + + private static class withError_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withCollisioin_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_args"); + + private static final org.apache.thrift.protocol.TField INPUT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "input", org.apache.thrift.protocol.TType.STRING, (short) 3333); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withCollisioin_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withCollisioin_argsTupleSchemeFactory()); + } + + public String input; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + INPUT((short) 3333, "input"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 3333: // INPUT + return INPUT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.INPUT, + new org.apache.thrift.meta_data.FieldMetaData( + "input", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_args.class, metaDataMap); + } + + public withCollisioin_args() {} + + public withCollisioin_args(String input) { + this(); + this.input = input; + } + + /** Performs a deep copy on other. */ + public withCollisioin_args(withCollisioin_args other) { + if (other.isSetInput()) { + this.input = other.input; + } + } + + public withCollisioin_args deepCopy() { + return new withCollisioin_args(this); + } + + @Override + public void clear() { + this.input = null; + } + + public String getInput() { + return this.input; + } + + public withCollisioin_args setInput(String input) { + this.input = input; + return this; + } + + public void unsetInput() { + this.input = null; + } + + /** Returns true if field input is set (has been assigned a value) and false otherwise */ + public boolean isSetInput() { + return this.input != null; + } + + public void setInputIsSet(boolean value) { + if (!value) { + this.input = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case INPUT: + if (value == null) { + unsetInput(); + } else { + setInput((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case INPUT: + return getInput(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case INPUT: + return isSetInput(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withCollisioin_args) return this.equals((withCollisioin_args) that); + return false; + } + + public boolean equals(withCollisioin_args that) { + if (that == null) return false; + + boolean this_present_input = true && this.isSetInput(); + boolean that_present_input = true && that.isSetInput(); + if (this_present_input || that_present_input) { + if (!(this_present_input && that_present_input)) return false; + if (!this.input.equals(that.input)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_input = true && (isSetInput()); + list.add(present_input); + if (present_input) list.add(input); + + return list.hashCode(); + } + + @Override + public int compareTo(withCollisioin_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetInput()).compareTo(other.isSetInput()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInput()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.input, other.input); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withCollisioin_args("); + boolean first = true; + + sb.append("input:"); + if (this.input == null) { + sb.append("null"); + } else { + sb.append(this.input); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_argsStandardSchemeFactory implements SchemeFactory { + public withCollisioin_argsStandardScheme getScheme() { + return new withCollisioin_argsStandardScheme(); + } + } + + private static class withCollisioin_argsStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 3333: // INPUT + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.input != null) { + oprot.writeFieldBegin(INPUT_FIELD_DESC); + oprot.writeString(struct.input); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_argsTupleSchemeFactory implements SchemeFactory { + public withCollisioin_argsTupleScheme getScheme() { + return new withCollisioin_argsTupleScheme(); + } + } + + private static class withCollisioin_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetInput()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetInput()) { + oprot.writeString(struct.input); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } + } + } + } + + public static class withCollisioin_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withCollisioin_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withCollisioin_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_result.class, metaDataMap); + } + + public withCollisioin_result() {} + + public withCollisioin_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withCollisioin_result(withCollisioin_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withCollisioin_result deepCopy() { + return new withCollisioin_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withCollisioin_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withCollisioin_result) return this.equals((withCollisioin_result) that); + return false; + } + + public boolean equals(withCollisioin_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(withCollisioin_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withCollisioin_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_resultStandardSchemeFactory implements SchemeFactory { + public withCollisioin_resultStandardScheme getScheme() { + return new withCollisioin_resultStandardScheme(); + } + } + + private static class withCollisioin_resultStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_resultTupleSchemeFactory implements SchemeFactory { + public withCollisioin_resultTupleScheme getScheme() { + return new withCollisioin_resultTupleScheme(); + } + } + + private static class withCollisioin_resultTupleScheme + extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class noReturn_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new noReturn_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new noReturn_argsTupleSchemeFactory()); + } + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_args.class, metaDataMap); + } + + public noReturn_args() {} + + public noReturn_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public noReturn_args(noReturn_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public noReturn_args deepCopy() { + return new noReturn_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public noReturn_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof noReturn_args) return this.equals((noReturn_args) that); + return false; + } + + public boolean equals(noReturn_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_delay = true; + list.add(present_delay); + if (present_delay) list.add(delay); + + return list.hashCode(); + } + + @Override + public int compareTo(noReturn_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("noReturn_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_argsStandardSchemeFactory implements SchemeFactory { + public noReturn_argsStandardScheme getScheme() { + return new noReturn_argsStandardScheme(); + } + } + + private static class noReturn_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_argsTupleSchemeFactory implements SchemeFactory { + public noReturn_argsTupleScheme getScheme() { + return new noReturn_argsTupleScheme(); + } + } + + private static class noReturn_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + } + + public static class noReturn_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_result"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new noReturn_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new noReturn_resultTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_result.class, metaDataMap); + } + + public noReturn_result() {} + + /** Performs a deep copy on other. */ + public noReturn_result(noReturn_result other) {} + + public noReturn_result deepCopy() { + return new noReturn_result(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof noReturn_result) return this.equals((noReturn_result) that); + return false; + } + + public boolean equals(noReturn_result that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + return list.hashCode(); + } + + @Override + public int compareTo(noReturn_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("noReturn_result("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_resultStandardSchemeFactory implements SchemeFactory { + public noReturn_resultStandardScheme getScheme() { + return new noReturn_resultStandardScheme(); + } + } + + private static class noReturn_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_resultTupleSchemeFactory implements SchemeFactory { + public noReturn_resultTupleScheme getScheme() { + return new noReturn_resultTupleScheme(); + } + } + + private static class noReturn_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class oneWayHasArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayHasArgs_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new oneWayHasArgs_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new oneWayHasArgs_argsTupleSchemeFactory()); + } + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayHasArgs_args.class, metaDataMap); + } + + public oneWayHasArgs_args() {} + + public oneWayHasArgs_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public oneWayHasArgs_args(oneWayHasArgs_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public oneWayHasArgs_args deepCopy() { + return new oneWayHasArgs_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public oneWayHasArgs_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWayHasArgs_args) return this.equals((oneWayHasArgs_args) that); + return false; + } + + public boolean equals(oneWayHasArgs_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_delay = true; + list.add(present_delay); + if (present_delay) list.add(delay); + + return list.hashCode(); + } + + @Override + public int compareTo(oneWayHasArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWayHasArgs_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayHasArgs_argsStandardSchemeFactory implements SchemeFactory { + public oneWayHasArgs_argsStandardScheme getScheme() { + return new oneWayHasArgs_argsStandardScheme(); + } + } + + private static class oneWayHasArgs_argsStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayHasArgs_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayHasArgs_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayHasArgs_argsTupleSchemeFactory implements SchemeFactory { + public oneWayHasArgs_argsTupleScheme getScheme() { + return new oneWayHasArgs_argsTupleScheme(); + } + } + + private static class oneWayHasArgs_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + } + + public static class oneWay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWay_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new oneWay_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new oneWay_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWay_args.class, metaDataMap); + } + + public oneWay_args() {} + + /** Performs a deep copy on other. */ + public oneWay_args(oneWay_args other) {} + + public oneWay_args deepCopy() { + return new oneWay_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWay_args) return this.equals((oneWay_args) that); + return false; + } + + public boolean equals(oneWay_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + return list.hashCode(); + } + + @Override + public int compareTo(oneWay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWay_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWay_argsStandardSchemeFactory implements SchemeFactory { + public oneWay_argsStandardScheme getScheme() { + return new oneWay_argsStandardScheme(); + } + } + + private static class oneWay_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWay_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWay_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWay_argsTupleSchemeFactory implements SchemeFactory { + public oneWay_argsTupleScheme getScheme() { + return new oneWay_argsTupleScheme(); + } + } + + private static class oneWay_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class oneWayWithError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayWithError_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new oneWayWithError_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new oneWayWithError_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayWithError_args.class, metaDataMap); + } + + public oneWayWithError_args() {} + + /** Performs a deep copy on other. */ + public oneWayWithError_args(oneWayWithError_args other) {} + + public oneWayWithError_args deepCopy() { + return new oneWayWithError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWayWithError_args) return this.equals((oneWayWithError_args) that); + return false; + } + + public boolean equals(oneWayWithError_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + return list.hashCode(); + } + + @Override + public int compareTo(oneWayWithError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWayWithError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayWithError_argsStandardSchemeFactory implements SchemeFactory { + public oneWayWithError_argsStandardScheme getScheme() { + return new oneWayWithError_argsStandardScheme(); + } + } + + private static class oneWayWithError_argsStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayWithError_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayWithError_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayWithError_argsTupleSchemeFactory implements SchemeFactory { + public oneWayWithError_argsTupleScheme getScheme() { + return new oneWayWithError_argsTupleScheme(); + } + } + + private static class oneWayWithError_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class data_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_args"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new data_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new data_argsTupleSchemeFactory()); + } + + public User user; // required + public Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(data_args.class, metaDataMap); + } + + public data_args() {} + + public data_args(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public data_args(data_args other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public data_args deepCopy() { + return new data_args(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + public User getUser() { + return this.user; + } + + public data_args setUser(User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + public Account getAccount() { + return this.account; + } + + public data_args setAccount(Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof data_args) return this.equals((data_args) that); + return false; + } + + public boolean equals(data_args that) { + if (that == null) return false; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_user = true && (isSetUser()); + list.add(present_user); + if (present_user) list.add(user); + + boolean present_account = true && (isSetAccount()); + list.add(present_account); + if (present_account) list.add(account); + + return list.hashCode(); + } + + @Override + public int compareTo(data_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetUser()).compareTo(other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAccount()).compareTo(other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("data_args("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_argsStandardSchemeFactory implements SchemeFactory { + public data_argsStandardScheme getScheme() { + return new data_argsStandardScheme(); + } + } + + private static class data_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_argsTupleSchemeFactory implements SchemeFactory { + public data_argsTupleScheme getScheme() { + return new data_argsTupleScheme(); + } + } + + private static class data_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetUser()) { + optionals.set(0); + } + if (struct.isSetAccount()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetUser()) { + struct.user.write(oprot); + } + if (struct.isSetAccount()) { + struct.account.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } + if (incoming.get(1)) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + } + } + + public static class data_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRUCT, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new data_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new data_resultTupleSchemeFactory()); + } + + public UserAccount success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, UserAccount.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + data_result.class, metaDataMap); + } + + public data_result() {} + + public data_result(UserAccount success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public data_result(data_result other) { + if (other.isSetSuccess()) { + this.success = new UserAccount(other.success); + } + } + + public data_result deepCopy() { + return new data_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public UserAccount getSuccess() { + return this.success; + } + + public data_result setSuccess(UserAccount success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((UserAccount) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof data_result) return this.equals((data_result) that); + return false; + } + + public boolean equals(data_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(data_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("data_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_resultStandardSchemeFactory implements SchemeFactory { + public data_resultStandardScheme getScheme() { + return new data_resultStandardScheme(); + } + } + + private static class data_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_resultTupleSchemeFactory implements SchemeFactory { + public data_resultTupleScheme getScheme() { + return new data_resultTupleScheme(); + } + } + + private static class data_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/thrift/User.java b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/thrift/User.java new file mode 100644 index 000000000000..27c3b82d8bd4 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/thrift/User.java @@ -0,0 +1,597 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_3.thrift; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "all"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2025-02-27") +public class User + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("User"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "userId", org.apache.thrift.protocol.TType.STRING, (short) 2); + private static final org.apache.thrift.protocol.TField AGE_FIELD_DESC = + new org.apache.thrift.protocol.TField("age", org.apache.thrift.protocol.TType.I32, (short) 3); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new UserStandardSchemeFactory()); + schemes.put(TupleScheme.class, new UserTupleSchemeFactory()); + } + + public String name; // required + public String userId; // required + public int age; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + NAME((short) 1, "name"), + USER_ID((short) 2, "userId"), + AGE((short) 3, "age"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // NAME + return NAME; + case 2: // USER_ID + return USER_ID; + case 3: // AGE + return AGE; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __AGE_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.USER_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "userId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.AGE, + new org.apache.thrift.meta_data.FieldMetaData( + "age", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(User.class, metaDataMap); + } + + public User() {} + + public User(String name, String userId, int age) { + this(); + this.name = name; + this.userId = userId; + this.age = age; + setAgeIsSet(true); + } + + /** Performs a deep copy on other. */ + public User(User other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetName()) { + this.name = other.name; + } + if (other.isSetUserId()) { + this.userId = other.userId; + } + this.age = other.age; + } + + public User deepCopy() { + return new User(this); + } + + @Override + public void clear() { + this.name = null; + this.userId = null; + setAgeIsSet(false); + this.age = 0; + } + + public String getName() { + return this.name; + } + + public User setName(String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public String getUserId() { + return this.userId; + } + + public User setUserId(String userId) { + this.userId = userId; + return this; + } + + public void unsetUserId() { + this.userId = null; + } + + /** Returns true if field userId is set (has been assigned a value) and false otherwise */ + public boolean isSetUserId() { + return this.userId != null; + } + + public void setUserIdIsSet(boolean value) { + if (!value) { + this.userId = null; + } + } + + public int getAge() { + return this.age; + } + + public User setAge(int age) { + this.age = age; + setAgeIsSet(true); + return this; + } + + public void unsetAge() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __AGE_ISSET_ID); + } + + /** Returns true if field age is set (has been assigned a value) and false otherwise */ + public boolean isSetAge() { + return EncodingUtils.testBit(__isset_bitfield, __AGE_ISSET_ID); + } + + public void setAgeIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __AGE_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case NAME: + if (value == null) { + unsetName(); + } else { + setName((String) value); + } + break; + + case USER_ID: + if (value == null) { + unsetUserId(); + } else { + setUserId((String) value); + } + break; + + case AGE: + if (value == null) { + unsetAge(); + } else { + setAge((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case NAME: + return getName(); + + case USER_ID: + return getUserId(); + + case AGE: + return getAge(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case NAME: + return isSetName(); + case USER_ID: + return isSetUserId(); + case AGE: + return isSetAge(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof User) return this.equals((User) that); + return false; + } + + public boolean equals(User that) { + if (that == null) return false; + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + boolean this_present_userId = true && this.isSetUserId(); + boolean that_present_userId = true && that.isSetUserId(); + if (this_present_userId || that_present_userId) { + if (!(this_present_userId && that_present_userId)) return false; + if (!this.userId.equals(that.userId)) return false; + } + + boolean this_present_age = true; + boolean that_present_age = true; + if (this_present_age || that_present_age) { + if (!(this_present_age && that_present_age)) return false; + if (this.age != that.age) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_name = true && (isSetName()); + list.add(present_name); + if (present_name) list.add(name); + + boolean present_userId = true && (isSetUserId()); + list.add(present_userId); + if (present_userId) list.add(userId); + + boolean present_age = true; + list.add(present_age); + if (present_age) list.add(age); + + return list.hashCode(); + } + + @Override + public int compareTo(User other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetUserId()).compareTo(other.isSetUserId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAge()).compareTo(other.isSetAge()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAge()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.age, other.age); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("User("); + boolean first = true; + + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + if (!first) sb.append(", "); + sb.append("userId:"); + if (this.userId == null) { + sb.append("null"); + } else { + sb.append(this.userId); + } + first = false; + if (!first) sb.append(", "); + sb.append("age:"); + sb.append(this.age); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (name == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'name' was not present! Struct: " + toString()); + } + if (userId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'userId' was not present! Struct: " + toString()); + } + // alas, we cannot check 'age' because it's a primitive and you chose the non-beans generator. + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserStandardSchemeFactory implements SchemeFactory { + public UserStandardScheme getScheme() { + return new UserStandardScheme(); + } + } + + private static class UserStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // AGE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + if (!struct.isSetAge()) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'age' was not found in serialized data! Struct: " + toString()); + } + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, User struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + if (struct.userId != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userId); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(AGE_FIELD_DESC); + oprot.writeI32(struct.age); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserTupleSchemeFactory implements SchemeFactory { + public UserTupleScheme getScheme() { + return new UserTupleScheme(); + } + } + + private static class UserTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeString(struct.name); + oprot.writeString(struct.userId); + oprot.writeI32(struct.age); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.name = iprot.readString(); + struct.setNameIsSet(true); + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } + } +} diff --git a/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/thrift/UserAccount.java b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/thrift/UserAccount.java new file mode 100644 index 000000000000..fdcc51d22e08 --- /dev/null +++ b/instrumentation/thrift/thrift-0.9.3-testing/src/test/java/io/opentelemetry/instrumentation/thrift/v0_9_3/thrift/UserAccount.java @@ -0,0 +1,502 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.v0_9_3.thrift; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "all"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2025-02-27") +public class UserAccount + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("UserAccount"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new UserAccountStandardSchemeFactory()); + schemes.put(TupleScheme.class, new UserAccountTupleSchemeFactory()); + } + + public User user; // required + public Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserAccount.class, metaDataMap); + } + + public UserAccount() {} + + public UserAccount(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public UserAccount(UserAccount other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public UserAccount deepCopy() { + return new UserAccount(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + public User getUser() { + return this.user; + } + + public UserAccount setUser(User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + public Account getAccount() { + return this.account; + } + + public UserAccount setAccount(Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof UserAccount) return this.equals((UserAccount) that); + return false; + } + + public boolean equals(UserAccount that) { + if (that == null) return false; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_user = true && (isSetUser()); + list.add(present_user); + if (present_user) list.add(user); + + boolean present_account = true && (isSetAccount()); + list.add(present_account); + if (present_account) list.add(account); + + return list.hashCode(); + } + + @Override + public int compareTo(UserAccount other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetUser()).compareTo(other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAccount()).compareTo(other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("UserAccount("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (user == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'user' was not present! Struct: " + toString()); + } + if (account == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'account' was not present! Struct: " + toString()); + } + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserAccountStandardSchemeFactory implements SchemeFactory { + public UserAccountStandardScheme getScheme() { + return new UserAccountStandardScheme(); + } + } + + private static class UserAccountStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, UserAccount struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserAccountTupleSchemeFactory implements SchemeFactory { + public UserAccountTupleScheme getScheme() { + return new UserAccountTupleScheme(); + } + } + + private static class UserAccountTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + struct.user.write(oprot); + struct.account.write(oprot); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/build.gradle.kts b/instrumentation/thrift/thrift-common/library/build.gradle.kts new file mode 100644 index 000000000000..44fee0f36f1d --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/build.gradle.kts @@ -0,0 +1,10 @@ +plugins { + id("otel.library-instrumentation") +} + +dependencies { + library("org.apache.thrift:libthrift:0.7.0") + compileOnly("javax.annotation:javax.annotation-api:1.3.2") + compileOnly("com.google.auto.value:auto-value-annotations") + annotationProcessor("com.google.auto.value:auto-value") +} diff --git a/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/RequestScopeContext.java b/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/RequestScopeContext.java new file mode 100644 index 000000000000..e7574c9be8ae --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/RequestScopeContext.java @@ -0,0 +1,33 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.common; + +import com.google.auto.value.AutoValue; +import io.opentelemetry.context.Context; +import io.opentelemetry.context.Scope; +import javax.annotation.Nullable; + +@AutoValue +public abstract class RequestScopeContext { + + public static RequestScopeContext create( + ThriftRequest request, @Nullable Scope scope, Context context) { + return new AutoValue_RequestScopeContext(request, scope, context); + } + + public abstract ThriftRequest getRequest(); + + @Nullable + public abstract Scope getScope(); + + public abstract Context getContext(); + + public void close() { + if (getScope() != null) { + getScope().close(); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/SocketAccessor.java b/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/SocketAccessor.java new file mode 100644 index 000000000000..ea3e0e7de377 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/SocketAccessor.java @@ -0,0 +1,83 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.common; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.net.Socket; +import org.apache.thrift.transport.TNonblockingSocket; +import org.apache.thrift.transport.TSaslClientTransport; +import org.apache.thrift.transport.TSocket; +import org.apache.thrift.transport.TTransport; + +@SuppressWarnings("all") +public class SocketAccessor { + + private static final String LAYERED_TRANSPORT = + "org.apache.thrift.transport.layered.TLayeredTransport"; + private static final String FRAMED_TRANSPORT = "org.apache.thrift.transport.TFramedTransport"; + private static final String FAST_FRAMED_TRANSPORT = + "org.apache.thrift.transport.TFastFramedTransport"; + + private SocketAccessor() {} + + public static Socket getSocket(TTransport transport) { + if (transport == null) { + return null; + } + try { + if (transport instanceof TSocket) { + return ((TSocket) transport).getSocket(); + } + if (transport instanceof TNonblockingSocket) { + return ((TNonblockingSocket) transport).getSocketChannel().socket(); + } + if (transport instanceof TSaslClientTransport) { + return getSocket(((TSaslClientTransport) transport).getUnderlyingTransport()); + } + Class thisClass = transport.getClass(); + Class superClass = thisClass.getSuperclass(); + Class layeredTransport = getClass(LAYERED_TRANSPORT); + if (superClass != null && superClass == layeredTransport) { + Method parentMethod = superClass.getMethod("getInnerTransport"); + Object result = parentMethod.invoke(transport); + if (result != null && result instanceof TTransport) { + return getSocket((TTransport) result); + } + } + + if (thisClass == getClass(FRAMED_TRANSPORT)) { + return getInnerTransportSocket(thisClass, "transport_", transport); + } + if (thisClass == getClass(FAST_FRAMED_TRANSPORT)) { + return getInnerTransportSocket(thisClass, "underlying", transport); + } + } catch (Throwable e) { + return null; + } + return null; + } + + public static Class getClass(String className) { + try { + return Class.forName(className); + } catch (Throwable e) { + return null; + } + } + + private static Socket getInnerTransportSocket( + Class thisClass, String targetField, TTransport transport) + throws NoSuchFieldException, IllegalAccessException { + Field field = thisClass.getDeclaredField(targetField); + field.setAccessible(true); + Object fieldTransport = field.get(transport); + if (fieldTransport instanceof TTransport) { + return getSocket((TTransport) fieldTransport); + } + return null; + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/ThriftAttributesExtractor.java b/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/ThriftAttributesExtractor.java new file mode 100644 index 000000000000..a9091798255c --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/ThriftAttributesExtractor.java @@ -0,0 +1,27 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.common; + +import io.opentelemetry.api.common.AttributesBuilder; +import io.opentelemetry.context.Context; +import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; +import javax.annotation.Nullable; + +final class ThriftAttributesExtractor implements AttributesExtractor { + + @Override + public void onStart(AttributesBuilder attributes, Context parentContext, ThriftRequest request) { + // Request attributes captured on request end. + } + + @Override + public void onEnd( + AttributesBuilder attributes, + Context context, + ThriftRequest request, + @Nullable Integer status, + @Nullable Throwable error) {} +} diff --git a/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/ThriftHeaderGetter.java b/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/ThriftHeaderGetter.java new file mode 100644 index 000000000000..89fbc6e2cad2 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/ThriftHeaderGetter.java @@ -0,0 +1,27 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.common; + +import io.opentelemetry.context.propagation.TextMapGetter; +import javax.annotation.Nullable; + +public enum ThriftHeaderGetter implements TextMapGetter { + INSTANCE; + + @Override + public Iterable keys(ThriftRequest request) { + return request.getHeader().keySet(); + } + + @Override + @Nullable + public String get(@Nullable ThriftRequest request, String key) { + if (request == null) { + return null; + } + return request.getHeader().get(key); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/ThriftHeaderSetter.java b/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/ThriftHeaderSetter.java new file mode 100644 index 000000000000..ecc6fd90d59b --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/ThriftHeaderSetter.java @@ -0,0 +1,23 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.common; + +import io.opentelemetry.context.propagation.TextMapSetter; +import java.util.Map; +import javax.annotation.Nullable; + +public enum ThriftHeaderSetter implements TextMapSetter { + INSTANCE; + + @Override + public void set(@Nullable ThriftRequest request, String key, String value) { + if (request == null) { + return; + } + Map header = request.getHeader(); + header.put(key, value); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/ThriftInstrumenterFactory.java b/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/ThriftInstrumenterFactory.java new file mode 100644 index 000000000000..dec2443433b7 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/ThriftInstrumenterFactory.java @@ -0,0 +1,50 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.common; + +import io.opentelemetry.api.GlobalOpenTelemetry; +import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; +import io.opentelemetry.instrumentation.api.instrumenter.network.ClientAttributesExtractor; +import io.opentelemetry.instrumentation.api.instrumenter.network.ServerAttributesExtractor; +import io.opentelemetry.instrumentation.api.instrumenter.rpc.RpcClientAttributesExtractor; +import io.opentelemetry.instrumentation.api.instrumenter.rpc.RpcClientMetrics; +import io.opentelemetry.instrumentation.api.instrumenter.rpc.RpcServerAttributesExtractor; +import io.opentelemetry.instrumentation.api.instrumenter.rpc.RpcServerMetrics; +import io.opentelemetry.instrumentation.thrift.common.client.ThriftClientNetworkAttributesGetter; +import io.opentelemetry.instrumentation.thrift.common.server.ThriftServerNetworkAttributesGetter; + +public final class ThriftInstrumenterFactory { + + public static Instrumenter clientInstrumenter( + String instrumentationName) { + ThriftClientNetworkAttributesGetter netClientAttributesGetter = + new ThriftClientNetworkAttributesGetter(); + ThriftRpcAttributesGetter rpcAttributesGetter = ThriftRpcAttributesGetter.INSTANCE; + return Instrumenter.builder( + GlobalOpenTelemetry.get(), instrumentationName, new ThriftSpanNameExtractor()) + .setSpanStatusExtractor(ThriftSpanStatusExtractor.INSTANCE) + .addAttributesExtractor(RpcClientAttributesExtractor.create(rpcAttributesGetter)) + .addAttributesExtractor(ServerAttributesExtractor.create(netClientAttributesGetter)) + .addOperationMetrics(RpcClientMetrics.get()) + .buildClientInstrumenter(ThriftHeaderSetter.INSTANCE); + } + + public static Instrumenter serverInstrumenter( + String instrumentationName) { + ThriftServerNetworkAttributesGetter netServerAttributesGetter = + new ThriftServerNetworkAttributesGetter(); + ThriftRpcAttributesGetter rpcAttributesGetter = ThriftRpcAttributesGetter.INSTANCE; + return Instrumenter.builder( + GlobalOpenTelemetry.get(), instrumentationName, new ThriftSpanNameExtractor()) + .setSpanStatusExtractor(ThriftSpanStatusExtractor.INSTANCE) + .addAttributesExtractor(RpcServerAttributesExtractor.create(rpcAttributesGetter)) + .addAttributesExtractor(ClientAttributesExtractor.create(netServerAttributesGetter)) + .addOperationMetrics(RpcServerMetrics.get()) + .buildServerInstrumenter(ThriftHeaderGetter.INSTANCE); + } + + private ThriftInstrumenterFactory() {} +} diff --git a/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/ThriftRequest.java b/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/ThriftRequest.java new file mode 100644 index 000000000000..e5d3fffa9379 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/ThriftRequest.java @@ -0,0 +1,33 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.common; + +import com.google.auto.value.AutoValue; +import java.net.Socket; +import java.util.Map; +import javax.annotation.Nullable; + +@AutoValue +public abstract class ThriftRequest { + + public static ThriftRequest create( + @Nullable String serviceName, + String methodName, + @Nullable Socket socket, + Map header) { + return new AutoValue_ThriftRequest(serviceName, methodName, socket, header); + } + + @Nullable + public abstract String getServiceName(); + + public abstract String getMethodName(); + + @Nullable + public abstract Socket getSocket(); + + public abstract Map getHeader(); +} diff --git a/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/ThriftRpcAttributesGetter.java b/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/ThriftRpcAttributesGetter.java new file mode 100644 index 000000000000..6a22401cfc5e --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/ThriftRpcAttributesGetter.java @@ -0,0 +1,30 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.common; + +import io.opentelemetry.instrumentation.api.instrumenter.rpc.RpcAttributesGetter; +import javax.annotation.Nullable; + +public enum ThriftRpcAttributesGetter implements RpcAttributesGetter { + INSTANCE; + + @Override + public String getSystem(ThriftRequest request) { + return "thrift"; + } + + @Override + @Nullable + public String getService(ThriftRequest request) { + return request.getServiceName(); + } + + @Override + @Nullable + public String getMethod(ThriftRequest request) { + return request.getMethodName(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/ThriftSpanNameExtractor.java b/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/ThriftSpanNameExtractor.java new file mode 100644 index 000000000000..553f0cc1f1d6 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/ThriftSpanNameExtractor.java @@ -0,0 +1,15 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.common; + +import io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor; + +public final class ThriftSpanNameExtractor implements SpanNameExtractor { + @Override + public String extract(ThriftRequest request) { + return request.getMethodName(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/ThriftSpanStatusExtractor.java b/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/ThriftSpanStatusExtractor.java new file mode 100644 index 000000000000..4b2972ee5116 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/ThriftSpanStatusExtractor.java @@ -0,0 +1,28 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.common; + +import io.opentelemetry.api.trace.StatusCode; +import io.opentelemetry.instrumentation.api.instrumenter.SpanStatusBuilder; +import io.opentelemetry.instrumentation.api.instrumenter.SpanStatusExtractor; +import javax.annotation.Nullable; + +public final class ThriftSpanStatusExtractor + implements SpanStatusExtractor { + + public static final ThriftSpanStatusExtractor INSTANCE = new ThriftSpanStatusExtractor(); + + @Override + public void extract( + SpanStatusBuilder spanStatusBuilder, + ThriftRequest request, + @Nullable Integer status, + @Nullable Throwable error) { + if ((status != null && status > 0) || error != null) { + spanStatusBuilder.setStatus(StatusCode.ERROR); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/client/MethodAccessor.java b/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/client/MethodAccessor.java new file mode 100644 index 000000000000..7c94ae7636fe --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/client/MethodAccessor.java @@ -0,0 +1,31 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.common.client; + +import java.lang.reflect.Method; +import java.util.HashSet; +import java.util.Set; + +public class MethodAccessor { + + private MethodAccessor() {} + + public static Set voidMethodNames(String serviceName) { + Set methodNames = new HashSet<>(); + try { + Class clazz = Class.forName(serviceName); + Method[] declaredMethods = clazz.getDeclaredMethods(); + for (Method declaredMethod : declaredMethods) { + if (declaredMethod.getReturnType() == void.class) { + methodNames.add(declaredMethod.getName()); + } + } + } catch (ClassNotFoundException ignore) { + // ignore + } + return methodNames; + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/client/ThriftClientNetworkAttributesGetter.java b/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/client/ThriftClientNetworkAttributesGetter.java new file mode 100644 index 000000000000..ae040f468674 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/client/ThriftClientNetworkAttributesGetter.java @@ -0,0 +1,32 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.common.client; + +import io.opentelemetry.instrumentation.api.instrumenter.network.ServerAttributesGetter; +import io.opentelemetry.instrumentation.thrift.common.ThriftRequest; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.net.SocketAddress; +import javax.annotation.Nullable; + +public final class ThriftClientNetworkAttributesGetter + implements ServerAttributesGetter { + + @Nullable + @Override + public InetSocketAddress getServerInetSocketAddress( + ThriftRequest request, @Nullable Integer integer) { + Socket socket = request.getSocket(); + if (socket == null) { + return null; + } + SocketAddress address = socket.getRemoteSocketAddress(); + if (address instanceof InetSocketAddress) { + return (InetSocketAddress) address; + } + return null; + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/server/ThriftServerNetworkAttributesGetter.java b/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/server/ThriftServerNetworkAttributesGetter.java new file mode 100644 index 000000000000..76fdd7dd75a3 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/main/java/io/opentelemetry/instrumentation/thrift/common/server/ThriftServerNetworkAttributesGetter.java @@ -0,0 +1,38 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.thrift.common.server; + +import io.opentelemetry.instrumentation.api.instrumenter.network.ClientAttributesGetter; +import io.opentelemetry.instrumentation.api.instrumenter.network.ServerAttributesGetter; +import io.opentelemetry.instrumentation.thrift.common.ThriftRequest; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.net.SocketAddress; +import javax.annotation.Nullable; + +/** + * This class is internal and is hence not for public use. Its APIs are unstable and can change at + * any time. + */ +public final class ThriftServerNetworkAttributesGetter + implements ServerAttributesGetter, + ClientAttributesGetter { + + @Override + @Nullable + public InetSocketAddress getClientInetSocketAddress( + ThriftRequest request, @Nullable Integer status) { + Socket socket = request.getSocket(); + if (socket == null) { + return null; + } + SocketAddress address = socket.getRemoteSocketAddress(); + if (address instanceof InetSocketAddress) { + return (InetSocketAddress) address; + } + return null; + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_10_0/Account.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_10_0/Account.java new file mode 100644 index 000000000000..95cf0b8336f2 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_10_0/Account.java @@ -0,0 +1,489 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_10_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.10.0)", + date = "2025-02-27") +public class Account + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("Account"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField CARD_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "cardId", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new AccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new AccountTupleSchemeFactory(); + + public java.lang.String zone; // required + public java.lang.String cardId; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + CARD_ID((short) 2, "cardId"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // CARD_ID + return CARD_ID; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.CARD_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "cardId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Account.class, metaDataMap); + } + + public Account() {} + + public Account(java.lang.String zone, java.lang.String cardId) { + this(); + this.zone = zone; + this.cardId = cardId; + } + + /** Performs a deep copy on other. */ + public Account(Account other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetCardId()) { + this.cardId = other.cardId; + } + } + + public Account deepCopy() { + return new Account(this); + } + + @Override + public void clear() { + this.zone = null; + this.cardId = null; + } + + public java.lang.String getZone() { + return this.zone; + } + + public Account setZone(java.lang.String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + public java.lang.String getCardId() { + return this.cardId; + } + + public Account setCardId(java.lang.String cardId) { + this.cardId = cardId; + return this; + } + + public void unsetCardId() { + this.cardId = null; + } + + /** Returns true if field cardId is set (has been assigned a value) and false otherwise */ + public boolean isSetCardId() { + return this.cardId != null; + } + + public void setCardIdIsSet(boolean value) { + if (!value) { + this.cardId = null; + } + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((java.lang.String) value); + } + break; + + case CARD_ID: + if (value == null) { + unsetCardId(); + } else { + setCardId((java.lang.String) value); + } + break; + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case CARD_ID: + return getCardId(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case CARD_ID: + return isSetCardId(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof Account) return this.equals((Account) that); + return false; + } + + public boolean equals(Account that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_cardId = true && this.isSetCardId(); + boolean that_present_cardId = true && that.isSetCardId(); + if (this_present_cardId || that_present_cardId) { + if (!(this_present_cardId && that_present_cardId)) return false; + if (!this.cardId.equals(that.cardId)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetCardId()) ? 131071 : 524287); + if (isSetCardId()) hashCode = hashCode * 8191 + cardId.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(Account other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetZone()).compareTo(other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.valueOf(isSetCardId()).compareTo(other.isSetCardId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCardId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cardId, other.cardId); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("Account("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("cardId:"); + if (this.cardId == null) { + sb.append("null"); + } else { + sb.append(this.cardId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (zone == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'zone' was not present! Struct: " + toString()); + } + if (cardId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'cardId' was not present! Struct: " + toString()); + } + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class AccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public AccountStandardScheme getScheme() { + return new AccountStandardScheme(); + } + } + + private static class AccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // CARD_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, Account struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.cardId != null) { + oprot.writeFieldBegin(CARD_ID_FIELD_DESC); + oprot.writeString(struct.cardId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class AccountTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public AccountTupleScheme getScheme() { + return new AccountTupleScheme(); + } + } + + private static class AccountTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.zone); + oprot.writeString(struct.cardId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_10_0/ThriftService.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_10_0/ThriftService.java new file mode 100644 index 000000000000..b00fc3151133 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_10_0/ThriftService.java @@ -0,0 +1,7975 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_10_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.10.0)", + date = "2025-02-27") +public class ThriftService { + + public interface Iface { + + public java.lang.String sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException; + + public java.lang.String withDelay(int delay) throws org.apache.thrift.TException; + + public java.lang.String withoutArgs() throws org.apache.thrift.TException; + + public java.lang.String withError() throws org.apache.thrift.TException; + + public java.lang.String withCollisioin(java.lang.String input) + throws org.apache.thrift.TException; + + public void noReturn(int delay) throws org.apache.thrift.TException; + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException; + + public void oneWay() throws org.apache.thrift.TException; + + public void oneWayWithError() throws org.apache.thrift.TException; + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException; + } + + public interface AsyncIface { + + public void sayHello( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withCollisioin( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + } + + public static class Client extends org.apache.thrift.TServiceClient implements Iface { + public static class Factory implements org.apache.thrift.TServiceClientFactory { + public Factory() {} + + public Client getClient(org.apache.thrift.protocol.TProtocol prot) { + return new Client(prot); + } + + public Client getClient( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + return new Client(iprot, oprot); + } + } + + public Client(org.apache.thrift.protocol.TProtocol prot) { + super(prot, prot); + } + + public Client( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + super(iprot, oprot); + } + + public java.lang.String sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException { + send_sayHello(zone, name); + return recv_sayHello(); + } + + public void send_sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException { + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + sendBase("sayHello", args); + } + + public java.lang.String recv_sayHello() throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + receiveBase(result, "sayHello"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "sayHello failed: unknown result"); + } + + public java.lang.String withDelay(int delay) throws org.apache.thrift.TException { + send_withDelay(delay); + return recv_withDelay(); + } + + public void send_withDelay(int delay) throws org.apache.thrift.TException { + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + sendBase("withDelay", args); + } + + public java.lang.String recv_withDelay() throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + receiveBase(result, "withDelay"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withDelay failed: unknown result"); + } + + public java.lang.String withoutArgs() throws org.apache.thrift.TException { + send_withoutArgs(); + return recv_withoutArgs(); + } + + public void send_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_args args = new withoutArgs_args(); + sendBase("withoutArgs", args); + } + + public java.lang.String recv_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + receiveBase(result, "withoutArgs"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withoutArgs failed: unknown result"); + } + + public java.lang.String withError() throws org.apache.thrift.TException { + send_withError(); + return recv_withError(); + } + + public void send_withError() throws org.apache.thrift.TException { + withError_args args = new withError_args(); + sendBase("withError", args); + } + + public java.lang.String recv_withError() throws org.apache.thrift.TException { + withError_result result = new withError_result(); + receiveBase(result, "withError"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withError failed: unknown result"); + } + + public java.lang.String withCollisioin(java.lang.String input) + throws org.apache.thrift.TException { + send_withCollisioin(input); + return recv_withCollisioin(); + } + + public void send_withCollisioin(java.lang.String input) throws org.apache.thrift.TException { + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + sendBase("withCollisioin", args); + } + + public java.lang.String recv_withCollisioin() throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + receiveBase(result, "withCollisioin"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withCollisioin failed: unknown result"); + } + + public void noReturn(int delay) throws org.apache.thrift.TException { + send_noReturn(delay); + recv_noReturn(); + } + + public void send_noReturn(int delay) throws org.apache.thrift.TException { + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + sendBase("noReturn", args); + } + + public void recv_noReturn() throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + receiveBase(result, "noReturn"); + return; + } + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException { + send_oneWayHasArgs(delay); + } + + public void send_oneWayHasArgs(int delay) throws org.apache.thrift.TException { + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + sendBaseOneway("oneWayHasArgs", args); + } + + public void oneWay() throws org.apache.thrift.TException { + send_oneWay(); + } + + public void send_oneWay() throws org.apache.thrift.TException { + oneWay_args args = new oneWay_args(); + sendBaseOneway("oneWay", args); + } + + public void oneWayWithError() throws org.apache.thrift.TException { + send_oneWayWithError(); + } + + public void send_oneWayWithError() throws org.apache.thrift.TException { + oneWayWithError_args args = new oneWayWithError_args(); + sendBaseOneway("oneWayWithError", args); + } + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException { + send_data(user, account); + return recv_data(); + } + + public void send_data(User user, Account account) throws org.apache.thrift.TException { + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + sendBase("data", args); + } + + public UserAccount recv_data() throws org.apache.thrift.TException { + data_result result = new data_result(); + receiveBase(result, "data"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, "data failed: unknown result"); + } + } + + public static class AsyncClient extends org.apache.thrift.async.TAsyncClient + implements AsyncIface { + public static class Factory + implements org.apache.thrift.async.TAsyncClientFactory { + private org.apache.thrift.async.TAsyncClientManager clientManager; + private org.apache.thrift.protocol.TProtocolFactory protocolFactory; + + public Factory( + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.protocol.TProtocolFactory protocolFactory) { + this.clientManager = clientManager; + this.protocolFactory = protocolFactory; + } + + public AsyncClient getAsyncClient( + org.apache.thrift.transport.TNonblockingTransport transport) { + return new AsyncClient(protocolFactory, clientManager, transport); + } + } + + public AsyncClient( + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.transport.TNonblockingTransport transport) { + super(protocolFactory, clientManager, transport); + } + + public void sayHello( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + sayHello_call method_call = + new sayHello_call(zone, name, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class sayHello_call + extends org.apache.thrift.async.TAsyncMethodCall { + private java.lang.String zone; + private java.lang.String name; + + public sayHello_call( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.zone = zone; + this.name = name; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "sayHello", org.apache.thrift.protocol.TMessageType.CALL, 0)); + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_sayHello(); + } + } + + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withDelay_call method_call = + new withDelay_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withDelay_call + extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public withDelay_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withDelay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withDelay(); + } + } + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withoutArgs_call method_call = + new withoutArgs_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withoutArgs_call + extends org.apache.thrift.async.TAsyncMethodCall { + public withoutArgs_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withoutArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withoutArgs_args args = new withoutArgs_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withoutArgs(); + } + } + + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withError_call method_call = + new withError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withError_call + extends org.apache.thrift.async.TAsyncMethodCall { + public withError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withError_args args = new withError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withError(); + } + } + + public void withCollisioin( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withCollisioin_call method_call = + new withCollisioin_call(input, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withCollisioin_call + extends org.apache.thrift.async.TAsyncMethodCall { + private java.lang.String input; + + public withCollisioin_call( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.input = input; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withCollisioin", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withCollisioin(); + } + } + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + noReturn_call method_call = + new noReturn_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class noReturn_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public noReturn_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "noReturn", org.apache.thrift.protocol.TMessageType.CALL, 0)); + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayHasArgs_call method_call = + new oneWayHasArgs_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayHasArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public oneWayHasArgs_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayHasArgs", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWay_call method_call = + new oneWay_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWay_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWay_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWay", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWay_args args = new oneWay_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayWithError_call method_call = + new oneWayWithError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayWithError_call + extends org.apache.thrift.async.TAsyncMethodCall { + public oneWayWithError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayWithError", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayWithError_args args = new oneWayWithError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + data_call method_call = + new data_call(user, account, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class data_call extends org.apache.thrift.async.TAsyncMethodCall { + private User user; + private Account account; + + public data_call( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.user = user; + this.account = account; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "data", org.apache.thrift.protocol.TMessageType.CALL, 0)); + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + args.write(prot); + prot.writeMessageEnd(); + } + + public UserAccount getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_data(); + } + } + } + + public static class Processor extends org.apache.thrift.TBaseProcessor + implements org.apache.thrift.TProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(Processor.class.getName()); + + public Processor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + java.lang.String, + org.apache.thrift.ProcessFunction>())); + } + + protected Processor( + I iface, + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + getProcessMap( + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.ProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + protected boolean isOneway() { + return false; + } + + public sayHello_result getResult(I iface, sayHello_args args) + throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + result.success = iface.sayHello(args.zone, args.name); + return result; + } + } + + public static class withDelay + extends org.apache.thrift.ProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + protected boolean isOneway() { + return false; + } + + public withDelay_result getResult(I iface, withDelay_args args) + throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + result.success = iface.withDelay(args.delay); + return result; + } + } + + public static class withoutArgs + extends org.apache.thrift.ProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + protected boolean isOneway() { + return false; + } + + public withoutArgs_result getResult(I iface, withoutArgs_args args) + throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + result.success = iface.withoutArgs(); + return result; + } + } + + public static class withError + extends org.apache.thrift.ProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + protected boolean isOneway() { + return false; + } + + public withError_result getResult(I iface, withError_args args) + throws org.apache.thrift.TException { + withError_result result = new withError_result(); + result.success = iface.withError(); + return result; + } + } + + public static class withCollisioin + extends org.apache.thrift.ProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + protected boolean isOneway() { + return false; + } + + public withCollisioin_result getResult(I iface, withCollisioin_args args) + throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + result.success = iface.withCollisioin(args.input); + return result; + } + } + + public static class noReturn + extends org.apache.thrift.ProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + protected boolean isOneway() { + return false; + } + + public noReturn_result getResult(I iface, noReturn_args args) + throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + iface.noReturn(args.delay); + return result; + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.ProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + protected boolean isOneway() { + return true; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayHasArgs_args args) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay); + return null; + } + } + + public static class oneWay + extends org.apache.thrift.ProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + protected boolean isOneway() { + return true; + } + + public org.apache.thrift.TBase getResult(I iface, oneWay_args args) + throws org.apache.thrift.TException { + iface.oneWay(); + return null; + } + } + + public static class oneWayWithError + extends org.apache.thrift.ProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + protected boolean isOneway() { + return true; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayWithError_args args) + throws org.apache.thrift.TException { + iface.oneWayWithError(); + return null; + } + } + + public static class data + extends org.apache.thrift.ProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + protected boolean isOneway() { + return false; + } + + public data_result getResult(I iface, data_args args) throws org.apache.thrift.TException { + data_result result = new data_result(); + result.success = iface.data(args.user, args.account); + return result; + } + } + } + + public static class AsyncProcessor + extends org.apache.thrift.TBaseAsyncProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(AsyncProcessor.class.getName()); + + public AsyncProcessor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>>())); + } + + protected AsyncProcessor( + I iface, + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction> + getProcessMap( + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.AsyncProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + sayHello_result result = new sayHello_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + sayHello_result result = new sayHello_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + sayHello_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.sayHello(args.zone, args.name, resultHandler); + } + } + + public static class withDelay + extends org.apache.thrift.AsyncProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withDelay_result result = new withDelay_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withDelay_result result = new withDelay_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withDelay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withDelay(args.delay, resultHandler); + } + } + + public static class withoutArgs + extends org.apache.thrift.AsyncProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withoutArgs_result result = new withoutArgs_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withoutArgs_result result = new withoutArgs_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withoutArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withoutArgs(resultHandler); + } + } + + public static class withError + extends org.apache.thrift.AsyncProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withError_result result = new withError_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withError_result result = new withError_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withError(resultHandler); + } + } + + public static class withCollisioin + extends org.apache.thrift.AsyncProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withCollisioin_result result = new withCollisioin_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withCollisioin_result result = new withCollisioin_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withCollisioin_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withCollisioin(args.input, resultHandler); + } + } + + public static class noReturn + extends org.apache.thrift.AsyncProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) { + noReturn_result result = new noReturn_result(); + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + noReturn_result result = new noReturn_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + noReturn_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.noReturn(args.delay, resultHandler); + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.AsyncProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWayHasArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay, resultHandler); + } + } + + public static class oneWay + extends org.apache.thrift.AsyncProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWay(resultHandler); + } + } + + public static class oneWayWithError + extends org.apache.thrift.AsyncProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWayWithError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayWithError(resultHandler); + } + } + + public static class data + extends org.apache.thrift.AsyncProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(UserAccount o) { + data_result result = new data_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + data_result result = new data_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + data_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.data(args.user, args.account, resultHandler); + } + } + } + + public static class sayHello_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_args"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_argsTupleSchemeFactory(); + + public java.lang.String zone; // required + public java.lang.String name; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + NAME((short) 2, "name"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // NAME + return NAME; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_args.class, metaDataMap); + } + + public sayHello_args() {} + + public sayHello_args(java.lang.String zone, java.lang.String name) { + this(); + this.zone = zone; + this.name = name; + } + + /** Performs a deep copy on other. */ + public sayHello_args(sayHello_args other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetName()) { + this.name = other.name; + } + } + + public sayHello_args deepCopy() { + return new sayHello_args(this); + } + + @Override + public void clear() { + this.zone = null; + this.name = null; + } + + public java.lang.String getZone() { + return this.zone; + } + + public sayHello_args setZone(java.lang.String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + public java.lang.String getName() { + return this.name; + } + + public sayHello_args setName(java.lang.String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((java.lang.String) value); + } + break; + + case NAME: + if (value == null) { + unsetName(); + } else { + setName((java.lang.String) value); + } + break; + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case NAME: + return getName(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case NAME: + return isSetName(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof sayHello_args) return this.equals((sayHello_args) that); + return false; + } + + public boolean equals(sayHello_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetZone()).compareTo(other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.valueOf(isSetName()).compareTo(other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("sayHello_args("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_argsStandardScheme getScheme() { + return new sayHello_argsStandardScheme(); + } + } + + private static class sayHello_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_argsTupleScheme getScheme() { + return new sayHello_argsTupleScheme(); + } + } + + private static class sayHello_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetZone()) { + optionals.set(0); + } + if (struct.isSetName()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetZone()) { + oprot.writeString(struct.zone); + } + if (struct.isSetName()) { + oprot.writeString(struct.name); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } + if (incoming.get(1)) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class sayHello_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_resultTupleSchemeFactory(); + + public java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_result.class, metaDataMap); + } + + public sayHello_result() {} + + public sayHello_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public sayHello_result(sayHello_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public sayHello_result deepCopy() { + return new sayHello_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public java.lang.String getSuccess() { + return this.success; + } + + public sayHello_result setSuccess(java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof sayHello_result) return this.equals((sayHello_result) that); + return false; + } + + public boolean equals(sayHello_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("sayHello_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_resultStandardScheme getScheme() { + return new sayHello_resultStandardScheme(); + } + } + + private static class sayHello_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_resultTupleScheme getScheme() { + return new sayHello_resultTupleScheme(); + } + } + + private static class sayHello_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withDelay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_args.class, metaDataMap); + } + + public withDelay_args() {} + + public withDelay_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public withDelay_args(withDelay_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public withDelay_args deepCopy() { + return new withDelay_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public withDelay_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withDelay_args) return this.equals((withDelay_args) that); + return false; + } + + public boolean equals(withDelay_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(withDelay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withDelay_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_argsStandardScheme getScheme() { + return new withDelay_argsStandardScheme(); + } + } + + private static class withDelay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_argsTupleScheme getScheme() { + return new withDelay_argsTupleScheme(); + } + } + + private static class withDelay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withDelay_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_resultTupleSchemeFactory(); + + public java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_result.class, metaDataMap); + } + + public withDelay_result() {} + + public withDelay_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withDelay_result(withDelay_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withDelay_result deepCopy() { + return new withDelay_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public java.lang.String getSuccess() { + return this.success; + } + + public withDelay_result setSuccess(java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withDelay_result) return this.equals((withDelay_result) that); + return false; + } + + public boolean equals(withDelay_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withDelay_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withDelay_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_resultStandardScheme getScheme() { + return new withDelay_resultStandardScheme(); + } + } + + private static class withDelay_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_resultTupleScheme getScheme() { + return new withDelay_resultTupleScheme(); + } + } + + private static class withDelay_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withoutArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_args.class, metaDataMap); + } + + public withoutArgs_args() {} + + /** Performs a deep copy on other. */ + public withoutArgs_args(withoutArgs_args other) {} + + public withoutArgs_args deepCopy() { + return new withoutArgs_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withoutArgs_args) return this.equals((withoutArgs_args) that); + return false; + } + + public boolean equals(withoutArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withoutArgs_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_argsStandardScheme getScheme() { + return new withoutArgs_argsStandardScheme(); + } + } + + private static class withoutArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_argsTupleScheme getScheme() { + return new withoutArgs_argsTupleScheme(); + } + } + + private static class withoutArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withoutArgs_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_resultTupleSchemeFactory(); + + public java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_result.class, metaDataMap); + } + + public withoutArgs_result() {} + + public withoutArgs_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withoutArgs_result(withoutArgs_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withoutArgs_result deepCopy() { + return new withoutArgs_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public java.lang.String getSuccess() { + return this.success; + } + + public withoutArgs_result setSuccess(java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withoutArgs_result) return this.equals((withoutArgs_result) that); + return false; + } + + public boolean equals(withoutArgs_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withoutArgs_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_resultStandardScheme getScheme() { + return new withoutArgs_resultStandardScheme(); + } + } + + private static class withoutArgs_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_resultTupleScheme getScheme() { + return new withoutArgs_resultTupleScheme(); + } + } + + private static class withoutArgs_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_args.class, metaDataMap); + } + + public withError_args() {} + + /** Performs a deep copy on other. */ + public withError_args(withError_args other) {} + + public withError_args deepCopy() { + return new withError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withError_args) return this.equals((withError_args) that); + return false; + } + + public boolean equals(withError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_argsStandardScheme getScheme() { + return new withError_argsStandardScheme(); + } + } + + private static class withError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_argsTupleScheme getScheme() { + return new withError_argsTupleScheme(); + } + } + + private static class withError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withError_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_resultTupleSchemeFactory(); + + public java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_result.class, metaDataMap); + } + + public withError_result() {} + + public withError_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withError_result(withError_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withError_result deepCopy() { + return new withError_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public java.lang.String getSuccess() { + return this.success; + } + + public withError_result setSuccess(java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withError_result) return this.equals((withError_result) that); + return false; + } + + public boolean equals(withError_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withError_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withError_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_resultStandardScheme getScheme() { + return new withError_resultStandardScheme(); + } + } + + private static class withError_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_resultTupleScheme getScheme() { + return new withError_resultTupleScheme(); + } + } + + private static class withError_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withCollisioin_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_args"); + + private static final org.apache.thrift.protocol.TField INPUT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "input", org.apache.thrift.protocol.TType.STRING, (short) 3333); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_argsTupleSchemeFactory(); + + public java.lang.String input; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + INPUT((short) 3333, "input"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 3333: // INPUT + return INPUT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.INPUT, + new org.apache.thrift.meta_data.FieldMetaData( + "input", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_args.class, metaDataMap); + } + + public withCollisioin_args() {} + + public withCollisioin_args(java.lang.String input) { + this(); + this.input = input; + } + + /** Performs a deep copy on other. */ + public withCollisioin_args(withCollisioin_args other) { + if (other.isSetInput()) { + this.input = other.input; + } + } + + public withCollisioin_args deepCopy() { + return new withCollisioin_args(this); + } + + @Override + public void clear() { + this.input = null; + } + + public java.lang.String getInput() { + return this.input; + } + + public withCollisioin_args setInput(java.lang.String input) { + this.input = input; + return this; + } + + public void unsetInput() { + this.input = null; + } + + /** Returns true if field input is set (has been assigned a value) and false otherwise */ + public boolean isSetInput() { + return this.input != null; + } + + public void setInputIsSet(boolean value) { + if (!value) { + this.input = null; + } + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case INPUT: + if (value == null) { + unsetInput(); + } else { + setInput((java.lang.String) value); + } + break; + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case INPUT: + return getInput(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case INPUT: + return isSetInput(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withCollisioin_args) return this.equals((withCollisioin_args) that); + return false; + } + + public boolean equals(withCollisioin_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_input = true && this.isSetInput(); + boolean that_present_input = true && that.isSetInput(); + if (this_present_input || that_present_input) { + if (!(this_present_input && that_present_input)) return false; + if (!this.input.equals(that.input)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetInput()) ? 131071 : 524287); + if (isSetInput()) hashCode = hashCode * 8191 + input.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetInput()).compareTo(other.isSetInput()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInput()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.input, other.input); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withCollisioin_args("); + boolean first = true; + + sb.append("input:"); + if (this.input == null) { + sb.append("null"); + } else { + sb.append(this.input); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_argsStandardScheme getScheme() { + return new withCollisioin_argsStandardScheme(); + } + } + + private static class withCollisioin_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 3333: // INPUT + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.input != null) { + oprot.writeFieldBegin(INPUT_FIELD_DESC); + oprot.writeString(struct.input); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_argsTupleScheme getScheme() { + return new withCollisioin_argsTupleScheme(); + } + } + + private static class withCollisioin_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetInput()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetInput()) { + oprot.writeString(struct.input); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withCollisioin_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_resultTupleSchemeFactory(); + + public java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_result.class, metaDataMap); + } + + public withCollisioin_result() {} + + public withCollisioin_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withCollisioin_result(withCollisioin_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withCollisioin_result deepCopy() { + return new withCollisioin_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public java.lang.String getSuccess() { + return this.success; + } + + public withCollisioin_result setSuccess(java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withCollisioin_result) return this.equals((withCollisioin_result) that); + return false; + } + + public boolean equals(withCollisioin_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withCollisioin_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_resultStandardScheme getScheme() { + return new withCollisioin_resultStandardScheme(); + } + } + + private static class withCollisioin_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_resultTupleScheme getScheme() { + return new withCollisioin_resultTupleScheme(); + } + } + + private static class withCollisioin_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class noReturn_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_args.class, metaDataMap); + } + + public noReturn_args() {} + + public noReturn_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public noReturn_args(noReturn_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public noReturn_args deepCopy() { + return new noReturn_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public noReturn_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof noReturn_args) return this.equals((noReturn_args) that); + return false; + } + + public boolean equals(noReturn_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(noReturn_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("noReturn_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_argsStandardScheme getScheme() { + return new noReturn_argsStandardScheme(); + } + } + + private static class noReturn_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_argsTupleScheme getScheme() { + return new noReturn_argsTupleScheme(); + } + } + + private static class noReturn_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class noReturn_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_result"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_resultTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_result.class, metaDataMap); + } + + public noReturn_result() {} + + /** Performs a deep copy on other. */ + public noReturn_result(noReturn_result other) {} + + public noReturn_result deepCopy() { + return new noReturn_result(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof noReturn_result) return this.equals((noReturn_result) that); + return false; + } + + public boolean equals(noReturn_result that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(noReturn_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("noReturn_result("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_resultStandardScheme getScheme() { + return new noReturn_resultStandardScheme(); + } + } + + private static class noReturn_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_resultTupleScheme getScheme() { + return new noReturn_resultTupleScheme(); + } + } + + private static class noReturn_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class oneWayHasArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayHasArgs_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayHasArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayHasArgs_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayHasArgs_args.class, metaDataMap); + } + + public oneWayHasArgs_args() {} + + public oneWayHasArgs_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public oneWayHasArgs_args(oneWayHasArgs_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public oneWayHasArgs_args deepCopy() { + return new oneWayHasArgs_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public oneWayHasArgs_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof oneWayHasArgs_args) return this.equals((oneWayHasArgs_args) that); + return false; + } + + public boolean equals(oneWayHasArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(oneWayHasArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWayHasArgs_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayHasArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayHasArgs_argsStandardScheme getScheme() { + return new oneWayHasArgs_argsStandardScheme(); + } + } + + private static class oneWayHasArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayHasArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayHasArgs_argsTupleScheme getScheme() { + return new oneWayHasArgs_argsTupleScheme(); + } + } + + private static class oneWayHasArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class oneWay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWay_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWay_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWay_args.class, metaDataMap); + } + + public oneWay_args() {} + + /** Performs a deep copy on other. */ + public oneWay_args(oneWay_args other) {} + + public oneWay_args deepCopy() { + return new oneWay_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof oneWay_args) return this.equals((oneWay_args) that); + return false; + } + + public boolean equals(oneWay_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWay_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWay_argsStandardScheme getScheme() { + return new oneWay_argsStandardScheme(); + } + } + + private static class oneWay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWay_argsTupleScheme getScheme() { + return new oneWay_argsTupleScheme(); + } + } + + private static class oneWay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class oneWayWithError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayWithError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayWithError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayWithError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayWithError_args.class, metaDataMap); + } + + public oneWayWithError_args() {} + + /** Performs a deep copy on other. */ + public oneWayWithError_args(oneWayWithError_args other) {} + + public oneWayWithError_args deepCopy() { + return new oneWayWithError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof oneWayWithError_args) return this.equals((oneWayWithError_args) that); + return false; + } + + public boolean equals(oneWayWithError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWayWithError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWayWithError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayWithError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayWithError_argsStandardScheme getScheme() { + return new oneWayWithError_argsStandardScheme(); + } + } + + private static class oneWayWithError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayWithError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayWithError_argsTupleScheme getScheme() { + return new oneWayWithError_argsTupleScheme(); + } + } + + private static class oneWayWithError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class data_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_args"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_argsTupleSchemeFactory(); + + public User user; // required + public Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(data_args.class, metaDataMap); + } + + public data_args() {} + + public data_args(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public data_args(data_args other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public data_args deepCopy() { + return new data_args(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + public User getUser() { + return this.user; + } + + public data_args setUser(User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + public Account getAccount() { + return this.account; + } + + public data_args setAccount(Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof data_args) return this.equals((data_args) that); + return false; + } + + public boolean equals(data_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetUser()).compareTo(other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.valueOf(isSetAccount()).compareTo(other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("data_args("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_argsStandardScheme getScheme() { + return new data_argsStandardScheme(); + } + } + + private static class data_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_argsTupleScheme getScheme() { + return new data_argsTupleScheme(); + } + } + + private static class data_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetUser()) { + optionals.set(0); + } + if (struct.isSetAccount()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetUser()) { + struct.user.write(oprot); + } + if (struct.isSetAccount()) { + struct.account.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } + if (incoming.get(1)) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class data_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRUCT, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_resultTupleSchemeFactory(); + + public UserAccount success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, UserAccount.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + data_result.class, metaDataMap); + } + + public data_result() {} + + public data_result(UserAccount success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public data_result(data_result other) { + if (other.isSetSuccess()) { + this.success = new UserAccount(other.success); + } + } + + public data_result deepCopy() { + return new data_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public UserAccount getSuccess() { + return this.success; + } + + public data_result setSuccess(UserAccount success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((UserAccount) value); + } + break; + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof data_result) return this.equals((data_result) that); + return false; + } + + public boolean equals(data_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("data_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_resultStandardScheme getScheme() { + return new data_resultStandardScheme(); + } + } + + private static class data_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_resultTupleScheme getScheme() { + return new data_resultTupleScheme(); + } + } + + private static class data_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_10_0/User.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_10_0/User.java new file mode 100644 index 000000000000..b5d440825c3f --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_10_0/User.java @@ -0,0 +1,590 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_10_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.10.0)", + date = "2025-02-27") +public class User + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("User"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "userId", org.apache.thrift.protocol.TType.STRING, (short) 2); + private static final org.apache.thrift.protocol.TField AGE_FIELD_DESC = + new org.apache.thrift.protocol.TField("age", org.apache.thrift.protocol.TType.I32, (short) 3); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserTupleSchemeFactory(); + + public java.lang.String name; // required + public java.lang.String userId; // required + public int age; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + NAME((short) 1, "name"), + USER_ID((short) 2, "userId"), + AGE((short) 3, "age"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // NAME + return NAME; + case 2: // USER_ID + return USER_ID; + case 3: // AGE + return AGE; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __AGE_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.USER_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "userId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.AGE, + new org.apache.thrift.meta_data.FieldMetaData( + "age", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(User.class, metaDataMap); + } + + public User() {} + + public User(java.lang.String name, java.lang.String userId, int age) { + this(); + this.name = name; + this.userId = userId; + this.age = age; + setAgeIsSet(true); + } + + /** Performs a deep copy on other. */ + public User(User other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetName()) { + this.name = other.name; + } + if (other.isSetUserId()) { + this.userId = other.userId; + } + this.age = other.age; + } + + public User deepCopy() { + return new User(this); + } + + @Override + public void clear() { + this.name = null; + this.userId = null; + setAgeIsSet(false); + this.age = 0; + } + + public java.lang.String getName() { + return this.name; + } + + public User setName(java.lang.String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public java.lang.String getUserId() { + return this.userId; + } + + public User setUserId(java.lang.String userId) { + this.userId = userId; + return this; + } + + public void unsetUserId() { + this.userId = null; + } + + /** Returns true if field userId is set (has been assigned a value) and false otherwise */ + public boolean isSetUserId() { + return this.userId != null; + } + + public void setUserIdIsSet(boolean value) { + if (!value) { + this.userId = null; + } + } + + public int getAge() { + return this.age; + } + + public User setAge(int age) { + this.age = age; + setAgeIsSet(true); + return this; + } + + public void unsetAge() { + __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __AGE_ISSET_ID); + } + + /** Returns true if field age is set (has been assigned a value) and false otherwise */ + public boolean isSetAge() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __AGE_ISSET_ID); + } + + public void setAgeIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __AGE_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case NAME: + if (value == null) { + unsetName(); + } else { + setName((java.lang.String) value); + } + break; + + case USER_ID: + if (value == null) { + unsetUserId(); + } else { + setUserId((java.lang.String) value); + } + break; + + case AGE: + if (value == null) { + unsetAge(); + } else { + setAge((java.lang.Integer) value); + } + break; + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case NAME: + return getName(); + + case USER_ID: + return getUserId(); + + case AGE: + return getAge(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case NAME: + return isSetName(); + case USER_ID: + return isSetUserId(); + case AGE: + return isSetAge(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof User) return this.equals((User) that); + return false; + } + + public boolean equals(User that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + boolean this_present_userId = true && this.isSetUserId(); + boolean that_present_userId = true && that.isSetUserId(); + if (this_present_userId || that_present_userId) { + if (!(this_present_userId && that_present_userId)) return false; + if (!this.userId.equals(that.userId)) return false; + } + + boolean this_present_age = true; + boolean that_present_age = true; + if (this_present_age || that_present_age) { + if (!(this_present_age && that_present_age)) return false; + if (this.age != that.age) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + hashCode = hashCode * 8191 + ((isSetUserId()) ? 131071 : 524287); + if (isSetUserId()) hashCode = hashCode * 8191 + userId.hashCode(); + + hashCode = hashCode * 8191 + age; + + return hashCode; + } + + @Override + public int compareTo(User other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetName()).compareTo(other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.valueOf(isSetUserId()).compareTo(other.isSetUserId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.valueOf(isSetAge()).compareTo(other.isSetAge()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAge()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.age, other.age); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("User("); + boolean first = true; + + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + if (!first) sb.append(", "); + sb.append("userId:"); + if (this.userId == null) { + sb.append("null"); + } else { + sb.append(this.userId); + } + first = false; + if (!first) sb.append(", "); + sb.append("age:"); + sb.append(this.age); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (name == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'name' was not present! Struct: " + toString()); + } + if (userId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'userId' was not present! Struct: " + toString()); + } + // alas, we cannot check 'age' because it's a primitive and you chose the non-beans generator. + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public UserStandardScheme getScheme() { + return new UserStandardScheme(); + } + } + + private static class UserStandardScheme extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // AGE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + if (!struct.isSetAge()) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'age' was not found in serialized data! Struct: " + toString()); + } + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, User struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + if (struct.userId != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userId); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(AGE_FIELD_DESC); + oprot.writeI32(struct.age); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public UserTupleScheme getScheme() { + return new UserTupleScheme(); + } + } + + private static class UserTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.name); + oprot.writeString(struct.userId); + oprot.writeI32(struct.age); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.name = iprot.readString(); + struct.setNameIsSet(true); + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_10_0/UserAccount.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_10_0/UserAccount.java new file mode 100644 index 000000000000..4d7d8b79d6fd --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_10_0/UserAccount.java @@ -0,0 +1,501 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_10_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.10.0)", + date = "2025-02-27") +public class UserAccount + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("UserAccount"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserAccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserAccountTupleSchemeFactory(); + + public User user; // required + public Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserAccount.class, metaDataMap); + } + + public UserAccount() {} + + public UserAccount(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public UserAccount(UserAccount other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public UserAccount deepCopy() { + return new UserAccount(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + public User getUser() { + return this.user; + } + + public UserAccount setUser(User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + public Account getAccount() { + return this.account; + } + + public UserAccount setAccount(Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof UserAccount) return this.equals((UserAccount) that); + return false; + } + + public boolean equals(UserAccount that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(UserAccount other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetUser()).compareTo(other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.valueOf(isSetAccount()).compareTo(other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("UserAccount("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (user == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'user' was not present! Struct: " + toString()); + } + if (account == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'account' was not present! Struct: " + toString()); + } + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserAccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public UserAccountStandardScheme getScheme() { + return new UserAccountStandardScheme(); + } + } + + private static class UserAccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, UserAccount struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserAccountTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public UserAccountTupleScheme getScheme() { + return new UserAccountTupleScheme(); + } + } + + private static class UserAccountTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user.write(oprot); + struct.account.write(oprot); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_11_0/Account.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_11_0/Account.java new file mode 100644 index 000000000000..036cbb8065ee --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_11_0/Account.java @@ -0,0 +1,489 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_11_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.11.0)", + date = "2025-02-27") +public class Account + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("Account"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField CARD_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "cardId", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new AccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new AccountTupleSchemeFactory(); + + public java.lang.String zone; // required + public java.lang.String cardId; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + CARD_ID((short) 2, "cardId"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // CARD_ID + return CARD_ID; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.CARD_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "cardId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Account.class, metaDataMap); + } + + public Account() {} + + public Account(java.lang.String zone, java.lang.String cardId) { + this(); + this.zone = zone; + this.cardId = cardId; + } + + /** Performs a deep copy on other. */ + public Account(Account other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetCardId()) { + this.cardId = other.cardId; + } + } + + public Account deepCopy() { + return new Account(this); + } + + @Override + public void clear() { + this.zone = null; + this.cardId = null; + } + + public java.lang.String getZone() { + return this.zone; + } + + public Account setZone(java.lang.String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + public java.lang.String getCardId() { + return this.cardId; + } + + public Account setCardId(java.lang.String cardId) { + this.cardId = cardId; + return this; + } + + public void unsetCardId() { + this.cardId = null; + } + + /** Returns true if field cardId is set (has been assigned a value) and false otherwise */ + public boolean isSetCardId() { + return this.cardId != null; + } + + public void setCardIdIsSet(boolean value) { + if (!value) { + this.cardId = null; + } + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((java.lang.String) value); + } + break; + + case CARD_ID: + if (value == null) { + unsetCardId(); + } else { + setCardId((java.lang.String) value); + } + break; + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case CARD_ID: + return getCardId(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case CARD_ID: + return isSetCardId(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof Account) return this.equals((Account) that); + return false; + } + + public boolean equals(Account that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_cardId = true && this.isSetCardId(); + boolean that_present_cardId = true && that.isSetCardId(); + if (this_present_cardId || that_present_cardId) { + if (!(this_present_cardId && that_present_cardId)) return false; + if (!this.cardId.equals(that.cardId)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetCardId()) ? 131071 : 524287); + if (isSetCardId()) hashCode = hashCode * 8191 + cardId.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(Account other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetZone()).compareTo(other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.valueOf(isSetCardId()).compareTo(other.isSetCardId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCardId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cardId, other.cardId); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("Account("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("cardId:"); + if (this.cardId == null) { + sb.append("null"); + } else { + sb.append(this.cardId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (zone == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'zone' was not present! Struct: " + toString()); + } + if (cardId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'cardId' was not present! Struct: " + toString()); + } + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class AccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public AccountStandardScheme getScheme() { + return new AccountStandardScheme(); + } + } + + private static class AccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // CARD_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, Account struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.cardId != null) { + oprot.writeFieldBegin(CARD_ID_FIELD_DESC); + oprot.writeString(struct.cardId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class AccountTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public AccountTupleScheme getScheme() { + return new AccountTupleScheme(); + } + } + + private static class AccountTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.zone); + oprot.writeString(struct.cardId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_11_0/ThriftService.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_11_0/ThriftService.java new file mode 100644 index 000000000000..f76977886a9f --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_11_0/ThriftService.java @@ -0,0 +1,8025 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_11_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.11.0)", + date = "2025-02-27") +public class ThriftService { + + public interface Iface { + + public java.lang.String sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException; + + public java.lang.String withDelay(int delay) throws org.apache.thrift.TException; + + public java.lang.String withoutArgs() throws org.apache.thrift.TException; + + public java.lang.String withError() throws org.apache.thrift.TException; + + public java.lang.String withCollisioin(java.lang.String input) + throws org.apache.thrift.TException; + + public void noReturn(int delay) throws org.apache.thrift.TException; + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException; + + public void oneWay() throws org.apache.thrift.TException; + + public void oneWayWithError() throws org.apache.thrift.TException; + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException; + } + + public interface AsyncIface { + + public void sayHello( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withCollisioin( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + } + + public static class Client extends org.apache.thrift.TServiceClient implements Iface { + public static class Factory implements org.apache.thrift.TServiceClientFactory { + public Factory() {} + + public Client getClient(org.apache.thrift.protocol.TProtocol prot) { + return new Client(prot); + } + + public Client getClient( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + return new Client(iprot, oprot); + } + } + + public Client(org.apache.thrift.protocol.TProtocol prot) { + super(prot, prot); + } + + public Client( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + super(iprot, oprot); + } + + public java.lang.String sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException { + send_sayHello(zone, name); + return recv_sayHello(); + } + + public void send_sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException { + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + sendBase("sayHello", args); + } + + public java.lang.String recv_sayHello() throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + receiveBase(result, "sayHello"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "sayHello failed: unknown result"); + } + + public java.lang.String withDelay(int delay) throws org.apache.thrift.TException { + send_withDelay(delay); + return recv_withDelay(); + } + + public void send_withDelay(int delay) throws org.apache.thrift.TException { + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + sendBase("withDelay", args); + } + + public java.lang.String recv_withDelay() throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + receiveBase(result, "withDelay"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withDelay failed: unknown result"); + } + + public java.lang.String withoutArgs() throws org.apache.thrift.TException { + send_withoutArgs(); + return recv_withoutArgs(); + } + + public void send_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_args args = new withoutArgs_args(); + sendBase("withoutArgs", args); + } + + public java.lang.String recv_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + receiveBase(result, "withoutArgs"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withoutArgs failed: unknown result"); + } + + public java.lang.String withError() throws org.apache.thrift.TException { + send_withError(); + return recv_withError(); + } + + public void send_withError() throws org.apache.thrift.TException { + withError_args args = new withError_args(); + sendBase("withError", args); + } + + public java.lang.String recv_withError() throws org.apache.thrift.TException { + withError_result result = new withError_result(); + receiveBase(result, "withError"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withError failed: unknown result"); + } + + public java.lang.String withCollisioin(java.lang.String input) + throws org.apache.thrift.TException { + send_withCollisioin(input); + return recv_withCollisioin(); + } + + public void send_withCollisioin(java.lang.String input) throws org.apache.thrift.TException { + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + sendBase("withCollisioin", args); + } + + public java.lang.String recv_withCollisioin() throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + receiveBase(result, "withCollisioin"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withCollisioin failed: unknown result"); + } + + public void noReturn(int delay) throws org.apache.thrift.TException { + send_noReturn(delay); + recv_noReturn(); + } + + public void send_noReturn(int delay) throws org.apache.thrift.TException { + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + sendBase("noReturn", args); + } + + public void recv_noReturn() throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + receiveBase(result, "noReturn"); + return; + } + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException { + send_oneWayHasArgs(delay); + } + + public void send_oneWayHasArgs(int delay) throws org.apache.thrift.TException { + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + sendBaseOneway("oneWayHasArgs", args); + } + + public void oneWay() throws org.apache.thrift.TException { + send_oneWay(); + } + + public void send_oneWay() throws org.apache.thrift.TException { + oneWay_args args = new oneWay_args(); + sendBaseOneway("oneWay", args); + } + + public void oneWayWithError() throws org.apache.thrift.TException { + send_oneWayWithError(); + } + + public void send_oneWayWithError() throws org.apache.thrift.TException { + oneWayWithError_args args = new oneWayWithError_args(); + sendBaseOneway("oneWayWithError", args); + } + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException { + send_data(user, account); + return recv_data(); + } + + public void send_data(User user, Account account) throws org.apache.thrift.TException { + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + sendBase("data", args); + } + + public UserAccount recv_data() throws org.apache.thrift.TException { + data_result result = new data_result(); + receiveBase(result, "data"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, "data failed: unknown result"); + } + } + + public static class AsyncClient extends org.apache.thrift.async.TAsyncClient + implements AsyncIface { + public static class Factory + implements org.apache.thrift.async.TAsyncClientFactory { + private org.apache.thrift.async.TAsyncClientManager clientManager; + private org.apache.thrift.protocol.TProtocolFactory protocolFactory; + + public Factory( + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.protocol.TProtocolFactory protocolFactory) { + this.clientManager = clientManager; + this.protocolFactory = protocolFactory; + } + + public AsyncClient getAsyncClient( + org.apache.thrift.transport.TNonblockingTransport transport) { + return new AsyncClient(protocolFactory, clientManager, transport); + } + } + + public AsyncClient( + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.transport.TNonblockingTransport transport) { + super(protocolFactory, clientManager, transport); + } + + public void sayHello( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + sayHello_call method_call = + new sayHello_call(zone, name, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class sayHello_call + extends org.apache.thrift.async.TAsyncMethodCall { + private java.lang.String zone; + private java.lang.String name; + + public sayHello_call( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.zone = zone; + this.name = name; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "sayHello", org.apache.thrift.protocol.TMessageType.CALL, 0)); + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_sayHello(); + } + } + + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withDelay_call method_call = + new withDelay_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withDelay_call + extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public withDelay_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withDelay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withDelay(); + } + } + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withoutArgs_call method_call = + new withoutArgs_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withoutArgs_call + extends org.apache.thrift.async.TAsyncMethodCall { + public withoutArgs_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withoutArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withoutArgs_args args = new withoutArgs_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withoutArgs(); + } + } + + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withError_call method_call = + new withError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withError_call + extends org.apache.thrift.async.TAsyncMethodCall { + public withError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withError_args args = new withError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withError(); + } + } + + public void withCollisioin( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withCollisioin_call method_call = + new withCollisioin_call(input, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withCollisioin_call + extends org.apache.thrift.async.TAsyncMethodCall { + private java.lang.String input; + + public withCollisioin_call( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.input = input; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withCollisioin", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withCollisioin(); + } + } + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + noReturn_call method_call = + new noReturn_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class noReturn_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public noReturn_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "noReturn", org.apache.thrift.protocol.TMessageType.CALL, 0)); + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayHasArgs_call method_call = + new oneWayHasArgs_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayHasArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public oneWayHasArgs_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayHasArgs", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWay_call method_call = + new oneWay_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWay_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWay_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWay", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWay_args args = new oneWay_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayWithError_call method_call = + new oneWayWithError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayWithError_call + extends org.apache.thrift.async.TAsyncMethodCall { + public oneWayWithError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayWithError", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayWithError_args args = new oneWayWithError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + data_call method_call = + new data_call(user, account, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class data_call extends org.apache.thrift.async.TAsyncMethodCall { + private User user; + private Account account; + + public data_call( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.user = user; + this.account = account; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "data", org.apache.thrift.protocol.TMessageType.CALL, 0)); + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + args.write(prot); + prot.writeMessageEnd(); + } + + public UserAccount getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_data(); + } + } + } + + public static class Processor extends org.apache.thrift.TBaseProcessor + implements org.apache.thrift.TProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(Processor.class.getName()); + + public Processor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + java.lang.String, + org.apache.thrift.ProcessFunction>())); + } + + protected Processor( + I iface, + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + getProcessMap( + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.ProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean handleRuntimeExceptions() { + return false; + } + + public sayHello_result getResult(I iface, sayHello_args args) + throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + result.success = iface.sayHello(args.zone, args.name); + return result; + } + } + + public static class withDelay + extends org.apache.thrift.ProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean handleRuntimeExceptions() { + return false; + } + + public withDelay_result getResult(I iface, withDelay_args args) + throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + result.success = iface.withDelay(args.delay); + return result; + } + } + + public static class withoutArgs + extends org.apache.thrift.ProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean handleRuntimeExceptions() { + return false; + } + + public withoutArgs_result getResult(I iface, withoutArgs_args args) + throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + result.success = iface.withoutArgs(); + return result; + } + } + + public static class withError + extends org.apache.thrift.ProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean handleRuntimeExceptions() { + return false; + } + + public withError_result getResult(I iface, withError_args args) + throws org.apache.thrift.TException { + withError_result result = new withError_result(); + result.success = iface.withError(); + return result; + } + } + + public static class withCollisioin + extends org.apache.thrift.ProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean handleRuntimeExceptions() { + return false; + } + + public withCollisioin_result getResult(I iface, withCollisioin_args args) + throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + result.success = iface.withCollisioin(args.input); + return result; + } + } + + public static class noReturn + extends org.apache.thrift.ProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean handleRuntimeExceptions() { + return false; + } + + public noReturn_result getResult(I iface, noReturn_args args) + throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + iface.noReturn(args.delay); + return result; + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.ProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + protected boolean isOneway() { + return true; + } + + @Override + protected boolean handleRuntimeExceptions() { + return false; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayHasArgs_args args) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay); + return null; + } + } + + public static class oneWay + extends org.apache.thrift.ProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + protected boolean isOneway() { + return true; + } + + @Override + protected boolean handleRuntimeExceptions() { + return false; + } + + public org.apache.thrift.TBase getResult(I iface, oneWay_args args) + throws org.apache.thrift.TException { + iface.oneWay(); + return null; + } + } + + public static class oneWayWithError + extends org.apache.thrift.ProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + protected boolean isOneway() { + return true; + } + + @Override + protected boolean handleRuntimeExceptions() { + return false; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayWithError_args args) + throws org.apache.thrift.TException { + iface.oneWayWithError(); + return null; + } + } + + public static class data + extends org.apache.thrift.ProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean handleRuntimeExceptions() { + return false; + } + + public data_result getResult(I iface, data_args args) throws org.apache.thrift.TException { + data_result result = new data_result(); + result.success = iface.data(args.user, args.account); + return result; + } + } + } + + public static class AsyncProcessor + extends org.apache.thrift.TBaseAsyncProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(AsyncProcessor.class.getName()); + + public AsyncProcessor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>>())); + } + + protected AsyncProcessor( + I iface, + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction> + getProcessMap( + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.AsyncProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + sayHello_result result = new sayHello_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + sayHello_result result = new sayHello_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + sayHello_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.sayHello(args.zone, args.name, resultHandler); + } + } + + public static class withDelay + extends org.apache.thrift.AsyncProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withDelay_result result = new withDelay_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withDelay_result result = new withDelay_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withDelay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withDelay(args.delay, resultHandler); + } + } + + public static class withoutArgs + extends org.apache.thrift.AsyncProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withoutArgs_result result = new withoutArgs_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withoutArgs_result result = new withoutArgs_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withoutArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withoutArgs(resultHandler); + } + } + + public static class withError + extends org.apache.thrift.AsyncProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withError_result result = new withError_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withError_result result = new withError_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withError(resultHandler); + } + } + + public static class withCollisioin + extends org.apache.thrift.AsyncProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withCollisioin_result result = new withCollisioin_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withCollisioin_result result = new withCollisioin_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withCollisioin_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withCollisioin(args.input, resultHandler); + } + } + + public static class noReturn + extends org.apache.thrift.AsyncProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) { + noReturn_result result = new noReturn_result(); + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + noReturn_result result = new noReturn_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + noReturn_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.noReturn(args.delay, resultHandler); + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.AsyncProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWayHasArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay, resultHandler); + } + } + + public static class oneWay + extends org.apache.thrift.AsyncProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWay(resultHandler); + } + } + + public static class oneWayWithError + extends org.apache.thrift.AsyncProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWayWithError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayWithError(resultHandler); + } + } + + public static class data + extends org.apache.thrift.AsyncProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(UserAccount o) { + data_result result = new data_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + data_result result = new data_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + data_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.data(args.user, args.account, resultHandler); + } + } + } + + public static class sayHello_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_args"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_argsTupleSchemeFactory(); + + public java.lang.String zone; // required + public java.lang.String name; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + NAME((short) 2, "name"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // NAME + return NAME; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_args.class, metaDataMap); + } + + public sayHello_args() {} + + public sayHello_args(java.lang.String zone, java.lang.String name) { + this(); + this.zone = zone; + this.name = name; + } + + /** Performs a deep copy on other. */ + public sayHello_args(sayHello_args other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetName()) { + this.name = other.name; + } + } + + public sayHello_args deepCopy() { + return new sayHello_args(this); + } + + @Override + public void clear() { + this.zone = null; + this.name = null; + } + + public java.lang.String getZone() { + return this.zone; + } + + public sayHello_args setZone(java.lang.String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + public java.lang.String getName() { + return this.name; + } + + public sayHello_args setName(java.lang.String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((java.lang.String) value); + } + break; + + case NAME: + if (value == null) { + unsetName(); + } else { + setName((java.lang.String) value); + } + break; + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case NAME: + return getName(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case NAME: + return isSetName(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof sayHello_args) return this.equals((sayHello_args) that); + return false; + } + + public boolean equals(sayHello_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetZone()).compareTo(other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.valueOf(isSetName()).compareTo(other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("sayHello_args("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_argsStandardScheme getScheme() { + return new sayHello_argsStandardScheme(); + } + } + + private static class sayHello_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_argsTupleScheme getScheme() { + return new sayHello_argsTupleScheme(); + } + } + + private static class sayHello_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetZone()) { + optionals.set(0); + } + if (struct.isSetName()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetZone()) { + oprot.writeString(struct.zone); + } + if (struct.isSetName()) { + oprot.writeString(struct.name); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } + if (incoming.get(1)) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class sayHello_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_resultTupleSchemeFactory(); + + public java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_result.class, metaDataMap); + } + + public sayHello_result() {} + + public sayHello_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public sayHello_result(sayHello_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public sayHello_result deepCopy() { + return new sayHello_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public java.lang.String getSuccess() { + return this.success; + } + + public sayHello_result setSuccess(java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof sayHello_result) return this.equals((sayHello_result) that); + return false; + } + + public boolean equals(sayHello_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("sayHello_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_resultStandardScheme getScheme() { + return new sayHello_resultStandardScheme(); + } + } + + private static class sayHello_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_resultTupleScheme getScheme() { + return new sayHello_resultTupleScheme(); + } + } + + private static class sayHello_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withDelay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_args.class, metaDataMap); + } + + public withDelay_args() {} + + public withDelay_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public withDelay_args(withDelay_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public withDelay_args deepCopy() { + return new withDelay_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public withDelay_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withDelay_args) return this.equals((withDelay_args) that); + return false; + } + + public boolean equals(withDelay_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(withDelay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withDelay_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_argsStandardScheme getScheme() { + return new withDelay_argsStandardScheme(); + } + } + + private static class withDelay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_argsTupleScheme getScheme() { + return new withDelay_argsTupleScheme(); + } + } + + private static class withDelay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withDelay_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_resultTupleSchemeFactory(); + + public java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_result.class, metaDataMap); + } + + public withDelay_result() {} + + public withDelay_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withDelay_result(withDelay_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withDelay_result deepCopy() { + return new withDelay_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public java.lang.String getSuccess() { + return this.success; + } + + public withDelay_result setSuccess(java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withDelay_result) return this.equals((withDelay_result) that); + return false; + } + + public boolean equals(withDelay_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withDelay_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withDelay_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_resultStandardScheme getScheme() { + return new withDelay_resultStandardScheme(); + } + } + + private static class withDelay_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_resultTupleScheme getScheme() { + return new withDelay_resultTupleScheme(); + } + } + + private static class withDelay_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withoutArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_args.class, metaDataMap); + } + + public withoutArgs_args() {} + + /** Performs a deep copy on other. */ + public withoutArgs_args(withoutArgs_args other) {} + + public withoutArgs_args deepCopy() { + return new withoutArgs_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withoutArgs_args) return this.equals((withoutArgs_args) that); + return false; + } + + public boolean equals(withoutArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withoutArgs_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_argsStandardScheme getScheme() { + return new withoutArgs_argsStandardScheme(); + } + } + + private static class withoutArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_argsTupleScheme getScheme() { + return new withoutArgs_argsTupleScheme(); + } + } + + private static class withoutArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withoutArgs_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_resultTupleSchemeFactory(); + + public java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_result.class, metaDataMap); + } + + public withoutArgs_result() {} + + public withoutArgs_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withoutArgs_result(withoutArgs_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withoutArgs_result deepCopy() { + return new withoutArgs_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public java.lang.String getSuccess() { + return this.success; + } + + public withoutArgs_result setSuccess(java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withoutArgs_result) return this.equals((withoutArgs_result) that); + return false; + } + + public boolean equals(withoutArgs_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withoutArgs_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_resultStandardScheme getScheme() { + return new withoutArgs_resultStandardScheme(); + } + } + + private static class withoutArgs_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_resultTupleScheme getScheme() { + return new withoutArgs_resultTupleScheme(); + } + } + + private static class withoutArgs_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_args.class, metaDataMap); + } + + public withError_args() {} + + /** Performs a deep copy on other. */ + public withError_args(withError_args other) {} + + public withError_args deepCopy() { + return new withError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withError_args) return this.equals((withError_args) that); + return false; + } + + public boolean equals(withError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_argsStandardScheme getScheme() { + return new withError_argsStandardScheme(); + } + } + + private static class withError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_argsTupleScheme getScheme() { + return new withError_argsTupleScheme(); + } + } + + private static class withError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withError_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_resultTupleSchemeFactory(); + + public java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_result.class, metaDataMap); + } + + public withError_result() {} + + public withError_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withError_result(withError_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withError_result deepCopy() { + return new withError_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public java.lang.String getSuccess() { + return this.success; + } + + public withError_result setSuccess(java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withError_result) return this.equals((withError_result) that); + return false; + } + + public boolean equals(withError_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withError_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withError_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_resultStandardScheme getScheme() { + return new withError_resultStandardScheme(); + } + } + + private static class withError_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_resultTupleScheme getScheme() { + return new withError_resultTupleScheme(); + } + } + + private static class withError_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withCollisioin_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_args"); + + private static final org.apache.thrift.protocol.TField INPUT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "input", org.apache.thrift.protocol.TType.STRING, (short) 3333); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_argsTupleSchemeFactory(); + + public java.lang.String input; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + INPUT((short) 3333, "input"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 3333: // INPUT + return INPUT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.INPUT, + new org.apache.thrift.meta_data.FieldMetaData( + "input", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_args.class, metaDataMap); + } + + public withCollisioin_args() {} + + public withCollisioin_args(java.lang.String input) { + this(); + this.input = input; + } + + /** Performs a deep copy on other. */ + public withCollisioin_args(withCollisioin_args other) { + if (other.isSetInput()) { + this.input = other.input; + } + } + + public withCollisioin_args deepCopy() { + return new withCollisioin_args(this); + } + + @Override + public void clear() { + this.input = null; + } + + public java.lang.String getInput() { + return this.input; + } + + public withCollisioin_args setInput(java.lang.String input) { + this.input = input; + return this; + } + + public void unsetInput() { + this.input = null; + } + + /** Returns true if field input is set (has been assigned a value) and false otherwise */ + public boolean isSetInput() { + return this.input != null; + } + + public void setInputIsSet(boolean value) { + if (!value) { + this.input = null; + } + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case INPUT: + if (value == null) { + unsetInput(); + } else { + setInput((java.lang.String) value); + } + break; + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case INPUT: + return getInput(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case INPUT: + return isSetInput(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withCollisioin_args) return this.equals((withCollisioin_args) that); + return false; + } + + public boolean equals(withCollisioin_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_input = true && this.isSetInput(); + boolean that_present_input = true && that.isSetInput(); + if (this_present_input || that_present_input) { + if (!(this_present_input && that_present_input)) return false; + if (!this.input.equals(that.input)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetInput()) ? 131071 : 524287); + if (isSetInput()) hashCode = hashCode * 8191 + input.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetInput()).compareTo(other.isSetInput()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInput()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.input, other.input); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withCollisioin_args("); + boolean first = true; + + sb.append("input:"); + if (this.input == null) { + sb.append("null"); + } else { + sb.append(this.input); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_argsStandardScheme getScheme() { + return new withCollisioin_argsStandardScheme(); + } + } + + private static class withCollisioin_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 3333: // INPUT + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.input != null) { + oprot.writeFieldBegin(INPUT_FIELD_DESC); + oprot.writeString(struct.input); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_argsTupleScheme getScheme() { + return new withCollisioin_argsTupleScheme(); + } + } + + private static class withCollisioin_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetInput()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetInput()) { + oprot.writeString(struct.input); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withCollisioin_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_resultTupleSchemeFactory(); + + public java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_result.class, metaDataMap); + } + + public withCollisioin_result() {} + + public withCollisioin_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withCollisioin_result(withCollisioin_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withCollisioin_result deepCopy() { + return new withCollisioin_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public java.lang.String getSuccess() { + return this.success; + } + + public withCollisioin_result setSuccess(java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withCollisioin_result) return this.equals((withCollisioin_result) that); + return false; + } + + public boolean equals(withCollisioin_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withCollisioin_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_resultStandardScheme getScheme() { + return new withCollisioin_resultStandardScheme(); + } + } + + private static class withCollisioin_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_resultTupleScheme getScheme() { + return new withCollisioin_resultTupleScheme(); + } + } + + private static class withCollisioin_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class noReturn_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_args.class, metaDataMap); + } + + public noReturn_args() {} + + public noReturn_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public noReturn_args(noReturn_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public noReturn_args deepCopy() { + return new noReturn_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public noReturn_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof noReturn_args) return this.equals((noReturn_args) that); + return false; + } + + public boolean equals(noReturn_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(noReturn_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("noReturn_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_argsStandardScheme getScheme() { + return new noReturn_argsStandardScheme(); + } + } + + private static class noReturn_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_argsTupleScheme getScheme() { + return new noReturn_argsTupleScheme(); + } + } + + private static class noReturn_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class noReturn_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_result"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_resultTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_result.class, metaDataMap); + } + + public noReturn_result() {} + + /** Performs a deep copy on other. */ + public noReturn_result(noReturn_result other) {} + + public noReturn_result deepCopy() { + return new noReturn_result(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof noReturn_result) return this.equals((noReturn_result) that); + return false; + } + + public boolean equals(noReturn_result that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(noReturn_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("noReturn_result("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_resultStandardScheme getScheme() { + return new noReturn_resultStandardScheme(); + } + } + + private static class noReturn_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_resultTupleScheme getScheme() { + return new noReturn_resultTupleScheme(); + } + } + + private static class noReturn_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class oneWayHasArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayHasArgs_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayHasArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayHasArgs_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayHasArgs_args.class, metaDataMap); + } + + public oneWayHasArgs_args() {} + + public oneWayHasArgs_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public oneWayHasArgs_args(oneWayHasArgs_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public oneWayHasArgs_args deepCopy() { + return new oneWayHasArgs_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public oneWayHasArgs_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof oneWayHasArgs_args) return this.equals((oneWayHasArgs_args) that); + return false; + } + + public boolean equals(oneWayHasArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(oneWayHasArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWayHasArgs_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayHasArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayHasArgs_argsStandardScheme getScheme() { + return new oneWayHasArgs_argsStandardScheme(); + } + } + + private static class oneWayHasArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayHasArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayHasArgs_argsTupleScheme getScheme() { + return new oneWayHasArgs_argsTupleScheme(); + } + } + + private static class oneWayHasArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class oneWay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWay_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWay_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWay_args.class, metaDataMap); + } + + public oneWay_args() {} + + /** Performs a deep copy on other. */ + public oneWay_args(oneWay_args other) {} + + public oneWay_args deepCopy() { + return new oneWay_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof oneWay_args) return this.equals((oneWay_args) that); + return false; + } + + public boolean equals(oneWay_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWay_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWay_argsStandardScheme getScheme() { + return new oneWay_argsStandardScheme(); + } + } + + private static class oneWay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWay_argsTupleScheme getScheme() { + return new oneWay_argsTupleScheme(); + } + } + + private static class oneWay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class oneWayWithError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayWithError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayWithError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayWithError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayWithError_args.class, metaDataMap); + } + + public oneWayWithError_args() {} + + /** Performs a deep copy on other. */ + public oneWayWithError_args(oneWayWithError_args other) {} + + public oneWayWithError_args deepCopy() { + return new oneWayWithError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof oneWayWithError_args) return this.equals((oneWayWithError_args) that); + return false; + } + + public boolean equals(oneWayWithError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWayWithError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWayWithError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayWithError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayWithError_argsStandardScheme getScheme() { + return new oneWayWithError_argsStandardScheme(); + } + } + + private static class oneWayWithError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayWithError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayWithError_argsTupleScheme getScheme() { + return new oneWayWithError_argsTupleScheme(); + } + } + + private static class oneWayWithError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class data_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_args"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_argsTupleSchemeFactory(); + + public User user; // required + public Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(data_args.class, metaDataMap); + } + + public data_args() {} + + public data_args(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public data_args(data_args other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public data_args deepCopy() { + return new data_args(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + public User getUser() { + return this.user; + } + + public data_args setUser(User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + public Account getAccount() { + return this.account; + } + + public data_args setAccount(Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof data_args) return this.equals((data_args) that); + return false; + } + + public boolean equals(data_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetUser()).compareTo(other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.valueOf(isSetAccount()).compareTo(other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("data_args("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_argsStandardScheme getScheme() { + return new data_argsStandardScheme(); + } + } + + private static class data_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_argsTupleScheme getScheme() { + return new data_argsTupleScheme(); + } + } + + private static class data_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetUser()) { + optionals.set(0); + } + if (struct.isSetAccount()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetUser()) { + struct.user.write(oprot); + } + if (struct.isSetAccount()) { + struct.account.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } + if (incoming.get(1)) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class data_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRUCT, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_resultTupleSchemeFactory(); + + public UserAccount success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, UserAccount.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + data_result.class, metaDataMap); + } + + public data_result() {} + + public data_result(UserAccount success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public data_result(data_result other) { + if (other.isSetSuccess()) { + this.success = new UserAccount(other.success); + } + } + + public data_result deepCopy() { + return new data_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public UserAccount getSuccess() { + return this.success; + } + + public data_result setSuccess(UserAccount success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((UserAccount) value); + } + break; + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof data_result) return this.equals((data_result) that); + return false; + } + + public boolean equals(data_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("data_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_resultStandardScheme getScheme() { + return new data_resultStandardScheme(); + } + } + + private static class data_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_resultTupleScheme getScheme() { + return new data_resultTupleScheme(); + } + } + + private static class data_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_11_0/User.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_11_0/User.java new file mode 100644 index 000000000000..b07113867418 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_11_0/User.java @@ -0,0 +1,590 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_11_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.11.0)", + date = "2025-02-27") +public class User + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("User"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "userId", org.apache.thrift.protocol.TType.STRING, (short) 2); + private static final org.apache.thrift.protocol.TField AGE_FIELD_DESC = + new org.apache.thrift.protocol.TField("age", org.apache.thrift.protocol.TType.I32, (short) 3); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserTupleSchemeFactory(); + + public java.lang.String name; // required + public java.lang.String userId; // required + public int age; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + NAME((short) 1, "name"), + USER_ID((short) 2, "userId"), + AGE((short) 3, "age"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // NAME + return NAME; + case 2: // USER_ID + return USER_ID; + case 3: // AGE + return AGE; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __AGE_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.USER_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "userId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.AGE, + new org.apache.thrift.meta_data.FieldMetaData( + "age", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(User.class, metaDataMap); + } + + public User() {} + + public User(java.lang.String name, java.lang.String userId, int age) { + this(); + this.name = name; + this.userId = userId; + this.age = age; + setAgeIsSet(true); + } + + /** Performs a deep copy on other. */ + public User(User other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetName()) { + this.name = other.name; + } + if (other.isSetUserId()) { + this.userId = other.userId; + } + this.age = other.age; + } + + public User deepCopy() { + return new User(this); + } + + @Override + public void clear() { + this.name = null; + this.userId = null; + setAgeIsSet(false); + this.age = 0; + } + + public java.lang.String getName() { + return this.name; + } + + public User setName(java.lang.String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public java.lang.String getUserId() { + return this.userId; + } + + public User setUserId(java.lang.String userId) { + this.userId = userId; + return this; + } + + public void unsetUserId() { + this.userId = null; + } + + /** Returns true if field userId is set (has been assigned a value) and false otherwise */ + public boolean isSetUserId() { + return this.userId != null; + } + + public void setUserIdIsSet(boolean value) { + if (!value) { + this.userId = null; + } + } + + public int getAge() { + return this.age; + } + + public User setAge(int age) { + this.age = age; + setAgeIsSet(true); + return this; + } + + public void unsetAge() { + __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __AGE_ISSET_ID); + } + + /** Returns true if field age is set (has been assigned a value) and false otherwise */ + public boolean isSetAge() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __AGE_ISSET_ID); + } + + public void setAgeIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __AGE_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case NAME: + if (value == null) { + unsetName(); + } else { + setName((java.lang.String) value); + } + break; + + case USER_ID: + if (value == null) { + unsetUserId(); + } else { + setUserId((java.lang.String) value); + } + break; + + case AGE: + if (value == null) { + unsetAge(); + } else { + setAge((java.lang.Integer) value); + } + break; + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case NAME: + return getName(); + + case USER_ID: + return getUserId(); + + case AGE: + return getAge(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case NAME: + return isSetName(); + case USER_ID: + return isSetUserId(); + case AGE: + return isSetAge(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof User) return this.equals((User) that); + return false; + } + + public boolean equals(User that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + boolean this_present_userId = true && this.isSetUserId(); + boolean that_present_userId = true && that.isSetUserId(); + if (this_present_userId || that_present_userId) { + if (!(this_present_userId && that_present_userId)) return false; + if (!this.userId.equals(that.userId)) return false; + } + + boolean this_present_age = true; + boolean that_present_age = true; + if (this_present_age || that_present_age) { + if (!(this_present_age && that_present_age)) return false; + if (this.age != that.age) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + hashCode = hashCode * 8191 + ((isSetUserId()) ? 131071 : 524287); + if (isSetUserId()) hashCode = hashCode * 8191 + userId.hashCode(); + + hashCode = hashCode * 8191 + age; + + return hashCode; + } + + @Override + public int compareTo(User other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetName()).compareTo(other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.valueOf(isSetUserId()).compareTo(other.isSetUserId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.valueOf(isSetAge()).compareTo(other.isSetAge()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAge()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.age, other.age); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("User("); + boolean first = true; + + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + if (!first) sb.append(", "); + sb.append("userId:"); + if (this.userId == null) { + sb.append("null"); + } else { + sb.append(this.userId); + } + first = false; + if (!first) sb.append(", "); + sb.append("age:"); + sb.append(this.age); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (name == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'name' was not present! Struct: " + toString()); + } + if (userId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'userId' was not present! Struct: " + toString()); + } + // alas, we cannot check 'age' because it's a primitive and you chose the non-beans generator. + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public UserStandardScheme getScheme() { + return new UserStandardScheme(); + } + } + + private static class UserStandardScheme extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // AGE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + if (!struct.isSetAge()) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'age' was not found in serialized data! Struct: " + toString()); + } + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, User struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + if (struct.userId != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userId); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(AGE_FIELD_DESC); + oprot.writeI32(struct.age); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public UserTupleScheme getScheme() { + return new UserTupleScheme(); + } + } + + private static class UserTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.name); + oprot.writeString(struct.userId); + oprot.writeI32(struct.age); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.name = iprot.readString(); + struct.setNameIsSet(true); + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_11_0/UserAccount.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_11_0/UserAccount.java new file mode 100644 index 000000000000..c67d0385e2f0 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_11_0/UserAccount.java @@ -0,0 +1,501 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_11_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.11.0)", + date = "2025-02-27") +public class UserAccount + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("UserAccount"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserAccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserAccountTupleSchemeFactory(); + + public User user; // required + public Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserAccount.class, metaDataMap); + } + + public UserAccount() {} + + public UserAccount(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public UserAccount(UserAccount other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public UserAccount deepCopy() { + return new UserAccount(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + public User getUser() { + return this.user; + } + + public UserAccount setUser(User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + public Account getAccount() { + return this.account; + } + + public UserAccount setAccount(Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue(_Fields field, java.lang.Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof UserAccount) return this.equals((UserAccount) that); + return false; + } + + public boolean equals(UserAccount that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(UserAccount other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetUser()).compareTo(other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.valueOf(isSetAccount()).compareTo(other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("UserAccount("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (user == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'user' was not present! Struct: " + toString()); + } + if (account == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'account' was not present! Struct: " + toString()); + } + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserAccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public UserAccountStandardScheme getScheme() { + return new UserAccountStandardScheme(); + } + } + + private static class UserAccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, UserAccount struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserAccountTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public UserAccountTupleScheme getScheme() { + return new UserAccountTupleScheme(); + } + } + + private static class UserAccountTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user.write(oprot); + struct.account.write(oprot); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_12_0/Account.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_12_0/Account.java new file mode 100644 index 000000000000..6cd6051c46f8 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_12_0/Account.java @@ -0,0 +1,496 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_12_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.12.0)", + date = "2025-02-27") +public class Account + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("Account"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField CARD_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "cardId", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new AccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new AccountTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String zone; // required + public @org.apache.thrift.annotation.Nullable java.lang.String cardId; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + CARD_ID((short) 2, "cardId"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // CARD_ID + return CARD_ID; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.CARD_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "cardId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Account.class, metaDataMap); + } + + public Account() {} + + public Account(java.lang.String zone, java.lang.String cardId) { + this(); + this.zone = zone; + this.cardId = cardId; + } + + /** Performs a deep copy on other. */ + public Account(Account other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetCardId()) { + this.cardId = other.cardId; + } + } + + public Account deepCopy() { + return new Account(this); + } + + @Override + public void clear() { + this.zone = null; + this.cardId = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getZone() { + return this.zone; + } + + public Account setZone(@org.apache.thrift.annotation.Nullable java.lang.String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getCardId() { + return this.cardId; + } + + public Account setCardId(@org.apache.thrift.annotation.Nullable java.lang.String cardId) { + this.cardId = cardId; + return this; + } + + public void unsetCardId() { + this.cardId = null; + } + + /** Returns true if field cardId is set (has been assigned a value) and false otherwise */ + public boolean isSetCardId() { + return this.cardId != null; + } + + public void setCardIdIsSet(boolean value) { + if (!value) { + this.cardId = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((java.lang.String) value); + } + break; + + case CARD_ID: + if (value == null) { + unsetCardId(); + } else { + setCardId((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case CARD_ID: + return getCardId(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case CARD_ID: + return isSetCardId(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof Account) return this.equals((Account) that); + return false; + } + + public boolean equals(Account that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_cardId = true && this.isSetCardId(); + boolean that_present_cardId = true && that.isSetCardId(); + if (this_present_cardId || that_present_cardId) { + if (!(this_present_cardId && that_present_cardId)) return false; + if (!this.cardId.equals(that.cardId)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetCardId()) ? 131071 : 524287); + if (isSetCardId()) hashCode = hashCode * 8191 + cardId.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(Account other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetZone()).compareTo(other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.valueOf(isSetCardId()).compareTo(other.isSetCardId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCardId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cardId, other.cardId); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("Account("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("cardId:"); + if (this.cardId == null) { + sb.append("null"); + } else { + sb.append(this.cardId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (zone == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'zone' was not present! Struct: " + toString()); + } + if (cardId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'cardId' was not present! Struct: " + toString()); + } + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class AccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public AccountStandardScheme getScheme() { + return new AccountStandardScheme(); + } + } + + private static class AccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // CARD_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, Account struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.cardId != null) { + oprot.writeFieldBegin(CARD_ID_FIELD_DESC); + oprot.writeString(struct.cardId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class AccountTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public AccountTupleScheme getScheme() { + return new AccountTupleScheme(); + } + } + + private static class AccountTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.zone); + oprot.writeString(struct.cardId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_12_0/ThriftService.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_12_0/ThriftService.java new file mode 100644 index 000000000000..82d3e739e83a --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_12_0/ThriftService.java @@ -0,0 +1,8127 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_12_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.12.0)", + date = "2025-02-27") +public class ThriftService { + + public interface Iface { + + public java.lang.String sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException; + + public java.lang.String withDelay(int delay) throws org.apache.thrift.TException; + + public java.lang.String withoutArgs() throws org.apache.thrift.TException; + + public java.lang.String withError() throws org.apache.thrift.TException; + + public java.lang.String withCollisioin(java.lang.String input) + throws org.apache.thrift.TException; + + public void noReturn(int delay) throws org.apache.thrift.TException; + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException; + + public void oneWay() throws org.apache.thrift.TException; + + public void oneWayWithError() throws org.apache.thrift.TException; + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException; + } + + public interface AsyncIface { + + public void sayHello( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withCollisioin( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + } + + public static class Client extends org.apache.thrift.TServiceClient implements Iface { + public static class Factory implements org.apache.thrift.TServiceClientFactory { + public Factory() {} + + public Client getClient(org.apache.thrift.protocol.TProtocol prot) { + return new Client(prot); + } + + public Client getClient( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + return new Client(iprot, oprot); + } + } + + public Client(org.apache.thrift.protocol.TProtocol prot) { + super(prot, prot); + } + + public Client( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + super(iprot, oprot); + } + + public java.lang.String sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException { + send_sayHello(zone, name); + return recv_sayHello(); + } + + public void send_sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException { + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + sendBase("sayHello", args); + } + + public java.lang.String recv_sayHello() throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + receiveBase(result, "sayHello"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "sayHello failed: unknown result"); + } + + public java.lang.String withDelay(int delay) throws org.apache.thrift.TException { + send_withDelay(delay); + return recv_withDelay(); + } + + public void send_withDelay(int delay) throws org.apache.thrift.TException { + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + sendBase("withDelay", args); + } + + public java.lang.String recv_withDelay() throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + receiveBase(result, "withDelay"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withDelay failed: unknown result"); + } + + public java.lang.String withoutArgs() throws org.apache.thrift.TException { + send_withoutArgs(); + return recv_withoutArgs(); + } + + public void send_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_args args = new withoutArgs_args(); + sendBase("withoutArgs", args); + } + + public java.lang.String recv_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + receiveBase(result, "withoutArgs"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withoutArgs failed: unknown result"); + } + + public java.lang.String withError() throws org.apache.thrift.TException { + send_withError(); + return recv_withError(); + } + + public void send_withError() throws org.apache.thrift.TException { + withError_args args = new withError_args(); + sendBase("withError", args); + } + + public java.lang.String recv_withError() throws org.apache.thrift.TException { + withError_result result = new withError_result(); + receiveBase(result, "withError"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withError failed: unknown result"); + } + + public java.lang.String withCollisioin(java.lang.String input) + throws org.apache.thrift.TException { + send_withCollisioin(input); + return recv_withCollisioin(); + } + + public void send_withCollisioin(java.lang.String input) throws org.apache.thrift.TException { + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + sendBase("withCollisioin", args); + } + + public java.lang.String recv_withCollisioin() throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + receiveBase(result, "withCollisioin"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withCollisioin failed: unknown result"); + } + + public void noReturn(int delay) throws org.apache.thrift.TException { + send_noReturn(delay); + recv_noReturn(); + } + + public void send_noReturn(int delay) throws org.apache.thrift.TException { + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + sendBase("noReturn", args); + } + + public void recv_noReturn() throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + receiveBase(result, "noReturn"); + return; + } + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException { + send_oneWayHasArgs(delay); + } + + public void send_oneWayHasArgs(int delay) throws org.apache.thrift.TException { + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + sendBaseOneway("oneWayHasArgs", args); + } + + public void oneWay() throws org.apache.thrift.TException { + send_oneWay(); + } + + public void send_oneWay() throws org.apache.thrift.TException { + oneWay_args args = new oneWay_args(); + sendBaseOneway("oneWay", args); + } + + public void oneWayWithError() throws org.apache.thrift.TException { + send_oneWayWithError(); + } + + public void send_oneWayWithError() throws org.apache.thrift.TException { + oneWayWithError_args args = new oneWayWithError_args(); + sendBaseOneway("oneWayWithError", args); + } + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException { + send_data(user, account); + return recv_data(); + } + + public void send_data(User user, Account account) throws org.apache.thrift.TException { + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + sendBase("data", args); + } + + public UserAccount recv_data() throws org.apache.thrift.TException { + data_result result = new data_result(); + receiveBase(result, "data"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, "data failed: unknown result"); + } + } + + public static class AsyncClient extends org.apache.thrift.async.TAsyncClient + implements AsyncIface { + public static class Factory + implements org.apache.thrift.async.TAsyncClientFactory { + private org.apache.thrift.async.TAsyncClientManager clientManager; + private org.apache.thrift.protocol.TProtocolFactory protocolFactory; + + public Factory( + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.protocol.TProtocolFactory protocolFactory) { + this.clientManager = clientManager; + this.protocolFactory = protocolFactory; + } + + public AsyncClient getAsyncClient( + org.apache.thrift.transport.TNonblockingTransport transport) { + return new AsyncClient(protocolFactory, clientManager, transport); + } + } + + public AsyncClient( + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.transport.TNonblockingTransport transport) { + super(protocolFactory, clientManager, transport); + } + + public void sayHello( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + sayHello_call method_call = + new sayHello_call(zone, name, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class sayHello_call + extends org.apache.thrift.async.TAsyncMethodCall { + private java.lang.String zone; + private java.lang.String name; + + public sayHello_call( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.zone = zone; + this.name = name; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "sayHello", org.apache.thrift.protocol.TMessageType.CALL, 0)); + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_sayHello(); + } + } + + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withDelay_call method_call = + new withDelay_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withDelay_call + extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public withDelay_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withDelay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withDelay(); + } + } + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withoutArgs_call method_call = + new withoutArgs_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withoutArgs_call + extends org.apache.thrift.async.TAsyncMethodCall { + public withoutArgs_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withoutArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withoutArgs_args args = new withoutArgs_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withoutArgs(); + } + } + + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withError_call method_call = + new withError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withError_call + extends org.apache.thrift.async.TAsyncMethodCall { + public withError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withError_args args = new withError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withError(); + } + } + + public void withCollisioin( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withCollisioin_call method_call = + new withCollisioin_call(input, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withCollisioin_call + extends org.apache.thrift.async.TAsyncMethodCall { + private java.lang.String input; + + public withCollisioin_call( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.input = input; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withCollisioin", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withCollisioin(); + } + } + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + noReturn_call method_call = + new noReturn_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class noReturn_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public noReturn_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "noReturn", org.apache.thrift.protocol.TMessageType.CALL, 0)); + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayHasArgs_call method_call = + new oneWayHasArgs_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayHasArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public oneWayHasArgs_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayHasArgs", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWay_call method_call = + new oneWay_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWay_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWay_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWay", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWay_args args = new oneWay_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayWithError_call method_call = + new oneWayWithError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayWithError_call + extends org.apache.thrift.async.TAsyncMethodCall { + public oneWayWithError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayWithError", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayWithError_args args = new oneWayWithError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + data_call method_call = + new data_call(user, account, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class data_call extends org.apache.thrift.async.TAsyncMethodCall { + private User user; + private Account account; + + public data_call( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.user = user; + this.account = account; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "data", org.apache.thrift.protocol.TMessageType.CALL, 0)); + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + args.write(prot); + prot.writeMessageEnd(); + } + + public UserAccount getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_data(); + } + } + } + + public static class Processor extends org.apache.thrift.TBaseProcessor + implements org.apache.thrift.TProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(Processor.class.getName()); + + public Processor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + java.lang.String, + org.apache.thrift.ProcessFunction>())); + } + + protected Processor( + I iface, + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + getProcessMap( + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.ProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public sayHello_result getResult(I iface, sayHello_args args) + throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + result.success = iface.sayHello(args.zone, args.name); + return result; + } + } + + public static class withDelay + extends org.apache.thrift.ProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withDelay_result getResult(I iface, withDelay_args args) + throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + result.success = iface.withDelay(args.delay); + return result; + } + } + + public static class withoutArgs + extends org.apache.thrift.ProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withoutArgs_result getResult(I iface, withoutArgs_args args) + throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + result.success = iface.withoutArgs(); + return result; + } + } + + public static class withError + extends org.apache.thrift.ProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withError_result getResult(I iface, withError_args args) + throws org.apache.thrift.TException { + withError_result result = new withError_result(); + result.success = iface.withError(); + return result; + } + } + + public static class withCollisioin + extends org.apache.thrift.ProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withCollisioin_result getResult(I iface, withCollisioin_args args) + throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + result.success = iface.withCollisioin(args.input); + return result; + } + } + + public static class noReturn + extends org.apache.thrift.ProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public noReturn_result getResult(I iface, noReturn_args args) + throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + iface.noReturn(args.delay); + return result; + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.ProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayHasArgs_args args) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay); + return null; + } + } + + public static class oneWay + extends org.apache.thrift.ProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public org.apache.thrift.TBase getResult(I iface, oneWay_args args) + throws org.apache.thrift.TException { + iface.oneWay(); + return null; + } + } + + public static class oneWayWithError + extends org.apache.thrift.ProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayWithError_args args) + throws org.apache.thrift.TException { + iface.oneWayWithError(); + return null; + } + } + + public static class data + extends org.apache.thrift.ProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public data_result getResult(I iface, data_args args) throws org.apache.thrift.TException { + data_result result = new data_result(); + result.success = iface.data(args.user, args.account); + return result; + } + } + } + + public static class AsyncProcessor + extends org.apache.thrift.TBaseAsyncProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(AsyncProcessor.class.getName()); + + public AsyncProcessor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>>())); + } + + protected AsyncProcessor( + I iface, + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction> + getProcessMap( + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.AsyncProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + sayHello_result result = new sayHello_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + sayHello_result result = new sayHello_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + sayHello_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.sayHello(args.zone, args.name, resultHandler); + } + } + + public static class withDelay + extends org.apache.thrift.AsyncProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withDelay_result result = new withDelay_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withDelay_result result = new withDelay_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withDelay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withDelay(args.delay, resultHandler); + } + } + + public static class withoutArgs + extends org.apache.thrift.AsyncProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withoutArgs_result result = new withoutArgs_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withoutArgs_result result = new withoutArgs_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withoutArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withoutArgs(resultHandler); + } + } + + public static class withError + extends org.apache.thrift.AsyncProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withError_result result = new withError_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withError_result result = new withError_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withError(resultHandler); + } + } + + public static class withCollisioin + extends org.apache.thrift.AsyncProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withCollisioin_result result = new withCollisioin_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withCollisioin_result result = new withCollisioin_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withCollisioin_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withCollisioin(args.input, resultHandler); + } + } + + public static class noReturn + extends org.apache.thrift.AsyncProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) { + noReturn_result result = new noReturn_result(); + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + noReturn_result result = new noReturn_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + noReturn_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.noReturn(args.delay, resultHandler); + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.AsyncProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWayHasArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay, resultHandler); + } + } + + public static class oneWay + extends org.apache.thrift.AsyncProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWay(resultHandler); + } + } + + public static class oneWayWithError + extends org.apache.thrift.AsyncProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWayWithError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayWithError(resultHandler); + } + } + + public static class data + extends org.apache.thrift.AsyncProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(UserAccount o) { + data_result result = new data_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + data_result result = new data_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + data_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.data(args.user, args.account, resultHandler); + } + } + } + + public static class sayHello_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_args"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String zone; // required + public @org.apache.thrift.annotation.Nullable java.lang.String name; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + NAME((short) 2, "name"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // NAME + return NAME; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_args.class, metaDataMap); + } + + public sayHello_args() {} + + public sayHello_args(java.lang.String zone, java.lang.String name) { + this(); + this.zone = zone; + this.name = name; + } + + /** Performs a deep copy on other. */ + public sayHello_args(sayHello_args other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetName()) { + this.name = other.name; + } + } + + public sayHello_args deepCopy() { + return new sayHello_args(this); + } + + @Override + public void clear() { + this.zone = null; + this.name = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getZone() { + return this.zone; + } + + public sayHello_args setZone(@org.apache.thrift.annotation.Nullable java.lang.String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getName() { + return this.name; + } + + public sayHello_args setName(@org.apache.thrift.annotation.Nullable java.lang.String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((java.lang.String) value); + } + break; + + case NAME: + if (value == null) { + unsetName(); + } else { + setName((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case NAME: + return getName(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case NAME: + return isSetName(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof sayHello_args) return this.equals((sayHello_args) that); + return false; + } + + public boolean equals(sayHello_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetZone()).compareTo(other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.valueOf(isSetName()).compareTo(other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("sayHello_args("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_argsStandardScheme getScheme() { + return new sayHello_argsStandardScheme(); + } + } + + private static class sayHello_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_argsTupleScheme getScheme() { + return new sayHello_argsTupleScheme(); + } + } + + private static class sayHello_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetZone()) { + optionals.set(0); + } + if (struct.isSetName()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetZone()) { + oprot.writeString(struct.zone); + } + if (struct.isSetName()) { + oprot.writeString(struct.name); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } + if (incoming.get(1)) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class sayHello_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_result.class, metaDataMap); + } + + public sayHello_result() {} + + public sayHello_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public sayHello_result(sayHello_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public sayHello_result deepCopy() { + return new sayHello_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public sayHello_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof sayHello_result) return this.equals((sayHello_result) that); + return false; + } + + public boolean equals(sayHello_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("sayHello_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_resultStandardScheme getScheme() { + return new sayHello_resultStandardScheme(); + } + } + + private static class sayHello_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_resultTupleScheme getScheme() { + return new sayHello_resultTupleScheme(); + } + } + + private static class sayHello_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withDelay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_args.class, metaDataMap); + } + + public withDelay_args() {} + + public withDelay_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public withDelay_args(withDelay_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public withDelay_args deepCopy() { + return new withDelay_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public withDelay_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withDelay_args) return this.equals((withDelay_args) that); + return false; + } + + public boolean equals(withDelay_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(withDelay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withDelay_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_argsStandardScheme getScheme() { + return new withDelay_argsStandardScheme(); + } + } + + private static class withDelay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_argsTupleScheme getScheme() { + return new withDelay_argsTupleScheme(); + } + } + + private static class withDelay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withDelay_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_result.class, metaDataMap); + } + + public withDelay_result() {} + + public withDelay_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withDelay_result(withDelay_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withDelay_result deepCopy() { + return new withDelay_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withDelay_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withDelay_result) return this.equals((withDelay_result) that); + return false; + } + + public boolean equals(withDelay_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withDelay_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withDelay_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_resultStandardScheme getScheme() { + return new withDelay_resultStandardScheme(); + } + } + + private static class withDelay_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_resultTupleScheme getScheme() { + return new withDelay_resultTupleScheme(); + } + } + + private static class withDelay_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withoutArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_args.class, metaDataMap); + } + + public withoutArgs_args() {} + + /** Performs a deep copy on other. */ + public withoutArgs_args(withoutArgs_args other) {} + + public withoutArgs_args deepCopy() { + return new withoutArgs_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withoutArgs_args) return this.equals((withoutArgs_args) that); + return false; + } + + public boolean equals(withoutArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withoutArgs_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_argsStandardScheme getScheme() { + return new withoutArgs_argsStandardScheme(); + } + } + + private static class withoutArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_argsTupleScheme getScheme() { + return new withoutArgs_argsTupleScheme(); + } + } + + private static class withoutArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withoutArgs_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_result.class, metaDataMap); + } + + public withoutArgs_result() {} + + public withoutArgs_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withoutArgs_result(withoutArgs_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withoutArgs_result deepCopy() { + return new withoutArgs_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withoutArgs_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withoutArgs_result) return this.equals((withoutArgs_result) that); + return false; + } + + public boolean equals(withoutArgs_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withoutArgs_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_resultStandardScheme getScheme() { + return new withoutArgs_resultStandardScheme(); + } + } + + private static class withoutArgs_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_resultTupleScheme getScheme() { + return new withoutArgs_resultTupleScheme(); + } + } + + private static class withoutArgs_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_args.class, metaDataMap); + } + + public withError_args() {} + + /** Performs a deep copy on other. */ + public withError_args(withError_args other) {} + + public withError_args deepCopy() { + return new withError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withError_args) return this.equals((withError_args) that); + return false; + } + + public boolean equals(withError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_argsStandardScheme getScheme() { + return new withError_argsStandardScheme(); + } + } + + private static class withError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_argsTupleScheme getScheme() { + return new withError_argsTupleScheme(); + } + } + + private static class withError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withError_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_result.class, metaDataMap); + } + + public withError_result() {} + + public withError_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withError_result(withError_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withError_result deepCopy() { + return new withError_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withError_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withError_result) return this.equals((withError_result) that); + return false; + } + + public boolean equals(withError_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withError_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withError_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_resultStandardScheme getScheme() { + return new withError_resultStandardScheme(); + } + } + + private static class withError_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_resultTupleScheme getScheme() { + return new withError_resultTupleScheme(); + } + } + + private static class withError_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withCollisioin_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_args"); + + private static final org.apache.thrift.protocol.TField INPUT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "input", org.apache.thrift.protocol.TType.STRING, (short) 3333); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String input; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + INPUT((short) 3333, "input"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 3333: // INPUT + return INPUT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.INPUT, + new org.apache.thrift.meta_data.FieldMetaData( + "input", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_args.class, metaDataMap); + } + + public withCollisioin_args() {} + + public withCollisioin_args(java.lang.String input) { + this(); + this.input = input; + } + + /** Performs a deep copy on other. */ + public withCollisioin_args(withCollisioin_args other) { + if (other.isSetInput()) { + this.input = other.input; + } + } + + public withCollisioin_args deepCopy() { + return new withCollisioin_args(this); + } + + @Override + public void clear() { + this.input = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getInput() { + return this.input; + } + + public withCollisioin_args setInput( + @org.apache.thrift.annotation.Nullable java.lang.String input) { + this.input = input; + return this; + } + + public void unsetInput() { + this.input = null; + } + + /** Returns true if field input is set (has been assigned a value) and false otherwise */ + public boolean isSetInput() { + return this.input != null; + } + + public void setInputIsSet(boolean value) { + if (!value) { + this.input = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case INPUT: + if (value == null) { + unsetInput(); + } else { + setInput((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case INPUT: + return getInput(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case INPUT: + return isSetInput(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withCollisioin_args) return this.equals((withCollisioin_args) that); + return false; + } + + public boolean equals(withCollisioin_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_input = true && this.isSetInput(); + boolean that_present_input = true && that.isSetInput(); + if (this_present_input || that_present_input) { + if (!(this_present_input && that_present_input)) return false; + if (!this.input.equals(that.input)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetInput()) ? 131071 : 524287); + if (isSetInput()) hashCode = hashCode * 8191 + input.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetInput()).compareTo(other.isSetInput()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInput()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.input, other.input); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withCollisioin_args("); + boolean first = true; + + sb.append("input:"); + if (this.input == null) { + sb.append("null"); + } else { + sb.append(this.input); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_argsStandardScheme getScheme() { + return new withCollisioin_argsStandardScheme(); + } + } + + private static class withCollisioin_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 3333: // INPUT + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.input != null) { + oprot.writeFieldBegin(INPUT_FIELD_DESC); + oprot.writeString(struct.input); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_argsTupleScheme getScheme() { + return new withCollisioin_argsTupleScheme(); + } + } + + private static class withCollisioin_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetInput()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetInput()) { + oprot.writeString(struct.input); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withCollisioin_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_result.class, metaDataMap); + } + + public withCollisioin_result() {} + + public withCollisioin_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withCollisioin_result(withCollisioin_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withCollisioin_result deepCopy() { + return new withCollisioin_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withCollisioin_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withCollisioin_result) return this.equals((withCollisioin_result) that); + return false; + } + + public boolean equals(withCollisioin_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withCollisioin_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_resultStandardScheme getScheme() { + return new withCollisioin_resultStandardScheme(); + } + } + + private static class withCollisioin_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_resultTupleScheme getScheme() { + return new withCollisioin_resultTupleScheme(); + } + } + + private static class withCollisioin_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class noReturn_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_args.class, metaDataMap); + } + + public noReturn_args() {} + + public noReturn_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public noReturn_args(noReturn_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public noReturn_args deepCopy() { + return new noReturn_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public noReturn_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof noReturn_args) return this.equals((noReturn_args) that); + return false; + } + + public boolean equals(noReturn_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(noReturn_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("noReturn_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_argsStandardScheme getScheme() { + return new noReturn_argsStandardScheme(); + } + } + + private static class noReturn_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_argsTupleScheme getScheme() { + return new noReturn_argsTupleScheme(); + } + } + + private static class noReturn_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class noReturn_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_result"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_resultTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_result.class, metaDataMap); + } + + public noReturn_result() {} + + /** Performs a deep copy on other. */ + public noReturn_result(noReturn_result other) {} + + public noReturn_result deepCopy() { + return new noReturn_result(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof noReturn_result) return this.equals((noReturn_result) that); + return false; + } + + public boolean equals(noReturn_result that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(noReturn_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("noReturn_result("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_resultStandardScheme getScheme() { + return new noReturn_resultStandardScheme(); + } + } + + private static class noReturn_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_resultTupleScheme getScheme() { + return new noReturn_resultTupleScheme(); + } + } + + private static class noReturn_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class oneWayHasArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayHasArgs_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayHasArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayHasArgs_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayHasArgs_args.class, metaDataMap); + } + + public oneWayHasArgs_args() {} + + public oneWayHasArgs_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public oneWayHasArgs_args(oneWayHasArgs_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public oneWayHasArgs_args deepCopy() { + return new oneWayHasArgs_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public oneWayHasArgs_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof oneWayHasArgs_args) return this.equals((oneWayHasArgs_args) that); + return false; + } + + public boolean equals(oneWayHasArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(oneWayHasArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWayHasArgs_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayHasArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayHasArgs_argsStandardScheme getScheme() { + return new oneWayHasArgs_argsStandardScheme(); + } + } + + private static class oneWayHasArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayHasArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayHasArgs_argsTupleScheme getScheme() { + return new oneWayHasArgs_argsTupleScheme(); + } + } + + private static class oneWayHasArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class oneWay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWay_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWay_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWay_args.class, metaDataMap); + } + + public oneWay_args() {} + + /** Performs a deep copy on other. */ + public oneWay_args(oneWay_args other) {} + + public oneWay_args deepCopy() { + return new oneWay_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof oneWay_args) return this.equals((oneWay_args) that); + return false; + } + + public boolean equals(oneWay_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWay_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWay_argsStandardScheme getScheme() { + return new oneWay_argsStandardScheme(); + } + } + + private static class oneWay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWay_argsTupleScheme getScheme() { + return new oneWay_argsTupleScheme(); + } + } + + private static class oneWay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class oneWayWithError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayWithError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayWithError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayWithError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayWithError_args.class, metaDataMap); + } + + public oneWayWithError_args() {} + + /** Performs a deep copy on other. */ + public oneWayWithError_args(oneWayWithError_args other) {} + + public oneWayWithError_args deepCopy() { + return new oneWayWithError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof oneWayWithError_args) return this.equals((oneWayWithError_args) that); + return false; + } + + public boolean equals(oneWayWithError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWayWithError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWayWithError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayWithError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayWithError_argsStandardScheme getScheme() { + return new oneWayWithError_argsStandardScheme(); + } + } + + private static class oneWayWithError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayWithError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayWithError_argsTupleScheme getScheme() { + return new oneWayWithError_argsTupleScheme(); + } + } + + private static class oneWayWithError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class data_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_args"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable User user; // required + public @org.apache.thrift.annotation.Nullable Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(data_args.class, metaDataMap); + } + + public data_args() {} + + public data_args(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public data_args(data_args other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public data_args deepCopy() { + return new data_args(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + @org.apache.thrift.annotation.Nullable + public User getUser() { + return this.user; + } + + public data_args setUser(@org.apache.thrift.annotation.Nullable User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + @org.apache.thrift.annotation.Nullable + public Account getAccount() { + return this.account; + } + + public data_args setAccount(@org.apache.thrift.annotation.Nullable Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof data_args) return this.equals((data_args) that); + return false; + } + + public boolean equals(data_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetUser()).compareTo(other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.valueOf(isSetAccount()).compareTo(other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("data_args("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_argsStandardScheme getScheme() { + return new data_argsStandardScheme(); + } + } + + private static class data_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_argsTupleScheme getScheme() { + return new data_argsTupleScheme(); + } + } + + private static class data_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetUser()) { + optionals.set(0); + } + if (struct.isSetAccount()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetUser()) { + struct.user.write(oprot); + } + if (struct.isSetAccount()) { + struct.account.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } + if (incoming.get(1)) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class data_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRUCT, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable UserAccount success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, UserAccount.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + data_result.class, metaDataMap); + } + + public data_result() {} + + public data_result(UserAccount success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public data_result(data_result other) { + if (other.isSetSuccess()) { + this.success = new UserAccount(other.success); + } + } + + public data_result deepCopy() { + return new data_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public UserAccount getSuccess() { + return this.success; + } + + public data_result setSuccess(@org.apache.thrift.annotation.Nullable UserAccount success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((UserAccount) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof data_result) return this.equals((data_result) that); + return false; + } + + public boolean equals(data_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("data_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_resultStandardScheme getScheme() { + return new data_resultStandardScheme(); + } + } + + private static class data_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_resultTupleScheme getScheme() { + return new data_resultTupleScheme(); + } + } + + private static class data_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_12_0/User.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_12_0/User.java new file mode 100644 index 000000000000..03633421d48f --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_12_0/User.java @@ -0,0 +1,597 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_12_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.12.0)", + date = "2025-02-27") +public class User + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("User"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "userId", org.apache.thrift.protocol.TType.STRING, (short) 2); + private static final org.apache.thrift.protocol.TField AGE_FIELD_DESC = + new org.apache.thrift.protocol.TField("age", org.apache.thrift.protocol.TType.I32, (short) 3); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String name; // required + public @org.apache.thrift.annotation.Nullable java.lang.String userId; // required + public int age; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + NAME((short) 1, "name"), + USER_ID((short) 2, "userId"), + AGE((short) 3, "age"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // NAME + return NAME; + case 2: // USER_ID + return USER_ID; + case 3: // AGE + return AGE; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __AGE_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.USER_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "userId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.AGE, + new org.apache.thrift.meta_data.FieldMetaData( + "age", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(User.class, metaDataMap); + } + + public User() {} + + public User(java.lang.String name, java.lang.String userId, int age) { + this(); + this.name = name; + this.userId = userId; + this.age = age; + setAgeIsSet(true); + } + + /** Performs a deep copy on other. */ + public User(User other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetName()) { + this.name = other.name; + } + if (other.isSetUserId()) { + this.userId = other.userId; + } + this.age = other.age; + } + + public User deepCopy() { + return new User(this); + } + + @Override + public void clear() { + this.name = null; + this.userId = null; + setAgeIsSet(false); + this.age = 0; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getName() { + return this.name; + } + + public User setName(@org.apache.thrift.annotation.Nullable java.lang.String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getUserId() { + return this.userId; + } + + public User setUserId(@org.apache.thrift.annotation.Nullable java.lang.String userId) { + this.userId = userId; + return this; + } + + public void unsetUserId() { + this.userId = null; + } + + /** Returns true if field userId is set (has been assigned a value) and false otherwise */ + public boolean isSetUserId() { + return this.userId != null; + } + + public void setUserIdIsSet(boolean value) { + if (!value) { + this.userId = null; + } + } + + public int getAge() { + return this.age; + } + + public User setAge(int age) { + this.age = age; + setAgeIsSet(true); + return this; + } + + public void unsetAge() { + __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __AGE_ISSET_ID); + } + + /** Returns true if field age is set (has been assigned a value) and false otherwise */ + public boolean isSetAge() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __AGE_ISSET_ID); + } + + public void setAgeIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __AGE_ISSET_ID, value); + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case NAME: + if (value == null) { + unsetName(); + } else { + setName((java.lang.String) value); + } + break; + + case USER_ID: + if (value == null) { + unsetUserId(); + } else { + setUserId((java.lang.String) value); + } + break; + + case AGE: + if (value == null) { + unsetAge(); + } else { + setAge((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case NAME: + return getName(); + + case USER_ID: + return getUserId(); + + case AGE: + return getAge(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case NAME: + return isSetName(); + case USER_ID: + return isSetUserId(); + case AGE: + return isSetAge(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof User) return this.equals((User) that); + return false; + } + + public boolean equals(User that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + boolean this_present_userId = true && this.isSetUserId(); + boolean that_present_userId = true && that.isSetUserId(); + if (this_present_userId || that_present_userId) { + if (!(this_present_userId && that_present_userId)) return false; + if (!this.userId.equals(that.userId)) return false; + } + + boolean this_present_age = true; + boolean that_present_age = true; + if (this_present_age || that_present_age) { + if (!(this_present_age && that_present_age)) return false; + if (this.age != that.age) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + hashCode = hashCode * 8191 + ((isSetUserId()) ? 131071 : 524287); + if (isSetUserId()) hashCode = hashCode * 8191 + userId.hashCode(); + + hashCode = hashCode * 8191 + age; + + return hashCode; + } + + @Override + public int compareTo(User other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetName()).compareTo(other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.valueOf(isSetUserId()).compareTo(other.isSetUserId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.valueOf(isSetAge()).compareTo(other.isSetAge()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAge()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.age, other.age); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("User("); + boolean first = true; + + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + if (!first) sb.append(", "); + sb.append("userId:"); + if (this.userId == null) { + sb.append("null"); + } else { + sb.append(this.userId); + } + first = false; + if (!first) sb.append(", "); + sb.append("age:"); + sb.append(this.age); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (name == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'name' was not present! Struct: " + toString()); + } + if (userId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'userId' was not present! Struct: " + toString()); + } + // alas, we cannot check 'age' because it's a primitive and you chose the non-beans generator. + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public UserStandardScheme getScheme() { + return new UserStandardScheme(); + } + } + + private static class UserStandardScheme extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // AGE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + if (!struct.isSetAge()) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'age' was not found in serialized data! Struct: " + toString()); + } + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, User struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + if (struct.userId != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userId); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(AGE_FIELD_DESC); + oprot.writeI32(struct.age); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public UserTupleScheme getScheme() { + return new UserTupleScheme(); + } + } + + private static class UserTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.name); + oprot.writeString(struct.userId); + oprot.writeI32(struct.age); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.name = iprot.readString(); + struct.setNameIsSet(true); + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_12_0/UserAccount.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_12_0/UserAccount.java new file mode 100644 index 000000000000..e21d733b3161 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_12_0/UserAccount.java @@ -0,0 +1,508 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_12_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.12.0)", + date = "2025-02-27") +public class UserAccount + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("UserAccount"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserAccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserAccountTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable User user; // required + public @org.apache.thrift.annotation.Nullable Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserAccount.class, metaDataMap); + } + + public UserAccount() {} + + public UserAccount(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public UserAccount(UserAccount other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public UserAccount deepCopy() { + return new UserAccount(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + @org.apache.thrift.annotation.Nullable + public User getUser() { + return this.user; + } + + public UserAccount setUser(@org.apache.thrift.annotation.Nullable User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + @org.apache.thrift.annotation.Nullable + public Account getAccount() { + return this.account; + } + + public UserAccount setAccount(@org.apache.thrift.annotation.Nullable Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof UserAccount) return this.equals((UserAccount) that); + return false; + } + + public boolean equals(UserAccount that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(UserAccount other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetUser()).compareTo(other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.valueOf(isSetAccount()).compareTo(other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("UserAccount("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (user == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'user' was not present! Struct: " + toString()); + } + if (account == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'account' was not present! Struct: " + toString()); + } + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserAccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public UserAccountStandardScheme getScheme() { + return new UserAccountStandardScheme(); + } + } + + private static class UserAccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, UserAccount struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserAccountTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public UserAccountTupleScheme getScheme() { + return new UserAccountTupleScheme(); + } + } + + private static class UserAccountTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user.write(oprot); + struct.account.write(oprot); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_13_0/Account.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_13_0/Account.java new file mode 100644 index 000000000000..426a3ea18368 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_13_0/Account.java @@ -0,0 +1,496 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_13_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.13.0)", + date = "2025-02-27") +public class Account + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("Account"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField CARD_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "cardId", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new AccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new AccountTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String zone; // required + public @org.apache.thrift.annotation.Nullable java.lang.String cardId; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + CARD_ID((short) 2, "cardId"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // CARD_ID + return CARD_ID; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.CARD_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "cardId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Account.class, metaDataMap); + } + + public Account() {} + + public Account(java.lang.String zone, java.lang.String cardId) { + this(); + this.zone = zone; + this.cardId = cardId; + } + + /** Performs a deep copy on other. */ + public Account(Account other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetCardId()) { + this.cardId = other.cardId; + } + } + + public Account deepCopy() { + return new Account(this); + } + + @Override + public void clear() { + this.zone = null; + this.cardId = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getZone() { + return this.zone; + } + + public Account setZone(@org.apache.thrift.annotation.Nullable java.lang.String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getCardId() { + return this.cardId; + } + + public Account setCardId(@org.apache.thrift.annotation.Nullable java.lang.String cardId) { + this.cardId = cardId; + return this; + } + + public void unsetCardId() { + this.cardId = null; + } + + /** Returns true if field cardId is set (has been assigned a value) and false otherwise */ + public boolean isSetCardId() { + return this.cardId != null; + } + + public void setCardIdIsSet(boolean value) { + if (!value) { + this.cardId = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((java.lang.String) value); + } + break; + + case CARD_ID: + if (value == null) { + unsetCardId(); + } else { + setCardId((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case CARD_ID: + return getCardId(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case CARD_ID: + return isSetCardId(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof Account) return this.equals((Account) that); + return false; + } + + public boolean equals(Account that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_cardId = true && this.isSetCardId(); + boolean that_present_cardId = true && that.isSetCardId(); + if (this_present_cardId || that_present_cardId) { + if (!(this_present_cardId && that_present_cardId)) return false; + if (!this.cardId.equals(that.cardId)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetCardId()) ? 131071 : 524287); + if (isSetCardId()) hashCode = hashCode * 8191 + cardId.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(Account other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetZone()).compareTo(other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.valueOf(isSetCardId()).compareTo(other.isSetCardId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCardId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cardId, other.cardId); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("Account("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("cardId:"); + if (this.cardId == null) { + sb.append("null"); + } else { + sb.append(this.cardId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (zone == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'zone' was not present! Struct: " + toString()); + } + if (cardId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'cardId' was not present! Struct: " + toString()); + } + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class AccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public AccountStandardScheme getScheme() { + return new AccountStandardScheme(); + } + } + + private static class AccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // CARD_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, Account struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.cardId != null) { + oprot.writeFieldBegin(CARD_ID_FIELD_DESC); + oprot.writeString(struct.cardId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class AccountTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public AccountTupleScheme getScheme() { + return new AccountTupleScheme(); + } + } + + private static class AccountTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.zone); + oprot.writeString(struct.cardId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_13_0/ThriftService.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_13_0/ThriftService.java new file mode 100644 index 000000000000..42f9442b6e1b --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_13_0/ThriftService.java @@ -0,0 +1,8127 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_13_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.13.0)", + date = "2025-02-27") +public class ThriftService { + + public interface Iface { + + public java.lang.String sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException; + + public java.lang.String withDelay(int delay) throws org.apache.thrift.TException; + + public java.lang.String withoutArgs() throws org.apache.thrift.TException; + + public java.lang.String withError() throws org.apache.thrift.TException; + + public java.lang.String withCollisioin(java.lang.String input) + throws org.apache.thrift.TException; + + public void noReturn(int delay) throws org.apache.thrift.TException; + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException; + + public void oneWay() throws org.apache.thrift.TException; + + public void oneWayWithError() throws org.apache.thrift.TException; + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException; + } + + public interface AsyncIface { + + public void sayHello( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withCollisioin( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + } + + public static class Client extends org.apache.thrift.TServiceClient implements Iface { + public static class Factory implements org.apache.thrift.TServiceClientFactory { + public Factory() {} + + public Client getClient(org.apache.thrift.protocol.TProtocol prot) { + return new Client(prot); + } + + public Client getClient( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + return new Client(iprot, oprot); + } + } + + public Client(org.apache.thrift.protocol.TProtocol prot) { + super(prot, prot); + } + + public Client( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + super(iprot, oprot); + } + + public java.lang.String sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException { + send_sayHello(zone, name); + return recv_sayHello(); + } + + public void send_sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException { + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + sendBase("sayHello", args); + } + + public java.lang.String recv_sayHello() throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + receiveBase(result, "sayHello"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "sayHello failed: unknown result"); + } + + public java.lang.String withDelay(int delay) throws org.apache.thrift.TException { + send_withDelay(delay); + return recv_withDelay(); + } + + public void send_withDelay(int delay) throws org.apache.thrift.TException { + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + sendBase("withDelay", args); + } + + public java.lang.String recv_withDelay() throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + receiveBase(result, "withDelay"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withDelay failed: unknown result"); + } + + public java.lang.String withoutArgs() throws org.apache.thrift.TException { + send_withoutArgs(); + return recv_withoutArgs(); + } + + public void send_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_args args = new withoutArgs_args(); + sendBase("withoutArgs", args); + } + + public java.lang.String recv_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + receiveBase(result, "withoutArgs"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withoutArgs failed: unknown result"); + } + + public java.lang.String withError() throws org.apache.thrift.TException { + send_withError(); + return recv_withError(); + } + + public void send_withError() throws org.apache.thrift.TException { + withError_args args = new withError_args(); + sendBase("withError", args); + } + + public java.lang.String recv_withError() throws org.apache.thrift.TException { + withError_result result = new withError_result(); + receiveBase(result, "withError"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withError failed: unknown result"); + } + + public java.lang.String withCollisioin(java.lang.String input) + throws org.apache.thrift.TException { + send_withCollisioin(input); + return recv_withCollisioin(); + } + + public void send_withCollisioin(java.lang.String input) throws org.apache.thrift.TException { + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + sendBase("withCollisioin", args); + } + + public java.lang.String recv_withCollisioin() throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + receiveBase(result, "withCollisioin"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withCollisioin failed: unknown result"); + } + + public void noReturn(int delay) throws org.apache.thrift.TException { + send_noReturn(delay); + recv_noReturn(); + } + + public void send_noReturn(int delay) throws org.apache.thrift.TException { + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + sendBase("noReturn", args); + } + + public void recv_noReturn() throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + receiveBase(result, "noReturn"); + return; + } + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException { + send_oneWayHasArgs(delay); + } + + public void send_oneWayHasArgs(int delay) throws org.apache.thrift.TException { + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + sendBaseOneway("oneWayHasArgs", args); + } + + public void oneWay() throws org.apache.thrift.TException { + send_oneWay(); + } + + public void send_oneWay() throws org.apache.thrift.TException { + oneWay_args args = new oneWay_args(); + sendBaseOneway("oneWay", args); + } + + public void oneWayWithError() throws org.apache.thrift.TException { + send_oneWayWithError(); + } + + public void send_oneWayWithError() throws org.apache.thrift.TException { + oneWayWithError_args args = new oneWayWithError_args(); + sendBaseOneway("oneWayWithError", args); + } + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException { + send_data(user, account); + return recv_data(); + } + + public void send_data(User user, Account account) throws org.apache.thrift.TException { + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + sendBase("data", args); + } + + public UserAccount recv_data() throws org.apache.thrift.TException { + data_result result = new data_result(); + receiveBase(result, "data"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, "data failed: unknown result"); + } + } + + public static class AsyncClient extends org.apache.thrift.async.TAsyncClient + implements AsyncIface { + public static class Factory + implements org.apache.thrift.async.TAsyncClientFactory { + private org.apache.thrift.async.TAsyncClientManager clientManager; + private org.apache.thrift.protocol.TProtocolFactory protocolFactory; + + public Factory( + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.protocol.TProtocolFactory protocolFactory) { + this.clientManager = clientManager; + this.protocolFactory = protocolFactory; + } + + public AsyncClient getAsyncClient( + org.apache.thrift.transport.TNonblockingTransport transport) { + return new AsyncClient(protocolFactory, clientManager, transport); + } + } + + public AsyncClient( + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.transport.TNonblockingTransport transport) { + super(protocolFactory, clientManager, transport); + } + + public void sayHello( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + sayHello_call method_call = + new sayHello_call(zone, name, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class sayHello_call + extends org.apache.thrift.async.TAsyncMethodCall { + private java.lang.String zone; + private java.lang.String name; + + public sayHello_call( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.zone = zone; + this.name = name; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "sayHello", org.apache.thrift.protocol.TMessageType.CALL, 0)); + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_sayHello(); + } + } + + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withDelay_call method_call = + new withDelay_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withDelay_call + extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public withDelay_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withDelay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withDelay(); + } + } + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withoutArgs_call method_call = + new withoutArgs_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withoutArgs_call + extends org.apache.thrift.async.TAsyncMethodCall { + public withoutArgs_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withoutArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withoutArgs_args args = new withoutArgs_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withoutArgs(); + } + } + + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withError_call method_call = + new withError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withError_call + extends org.apache.thrift.async.TAsyncMethodCall { + public withError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withError_args args = new withError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withError(); + } + } + + public void withCollisioin( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withCollisioin_call method_call = + new withCollisioin_call(input, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withCollisioin_call + extends org.apache.thrift.async.TAsyncMethodCall { + private java.lang.String input; + + public withCollisioin_call( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.input = input; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withCollisioin", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withCollisioin(); + } + } + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + noReturn_call method_call = + new noReturn_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class noReturn_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public noReturn_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "noReturn", org.apache.thrift.protocol.TMessageType.CALL, 0)); + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayHasArgs_call method_call = + new oneWayHasArgs_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayHasArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public oneWayHasArgs_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayHasArgs", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWay_call method_call = + new oneWay_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWay_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWay_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWay", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWay_args args = new oneWay_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayWithError_call method_call = + new oneWayWithError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayWithError_call + extends org.apache.thrift.async.TAsyncMethodCall { + public oneWayWithError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayWithError", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayWithError_args args = new oneWayWithError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + data_call method_call = + new data_call(user, account, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class data_call extends org.apache.thrift.async.TAsyncMethodCall { + private User user; + private Account account; + + public data_call( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.user = user; + this.account = account; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "data", org.apache.thrift.protocol.TMessageType.CALL, 0)); + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + args.write(prot); + prot.writeMessageEnd(); + } + + public UserAccount getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_data(); + } + } + } + + public static class Processor extends org.apache.thrift.TBaseProcessor + implements org.apache.thrift.TProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(Processor.class.getName()); + + public Processor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + java.lang.String, + org.apache.thrift.ProcessFunction>())); + } + + protected Processor( + I iface, + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + getProcessMap( + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.ProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public sayHello_result getResult(I iface, sayHello_args args) + throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + result.success = iface.sayHello(args.zone, args.name); + return result; + } + } + + public static class withDelay + extends org.apache.thrift.ProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withDelay_result getResult(I iface, withDelay_args args) + throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + result.success = iface.withDelay(args.delay); + return result; + } + } + + public static class withoutArgs + extends org.apache.thrift.ProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withoutArgs_result getResult(I iface, withoutArgs_args args) + throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + result.success = iface.withoutArgs(); + return result; + } + } + + public static class withError + extends org.apache.thrift.ProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withError_result getResult(I iface, withError_args args) + throws org.apache.thrift.TException { + withError_result result = new withError_result(); + result.success = iface.withError(); + return result; + } + } + + public static class withCollisioin + extends org.apache.thrift.ProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withCollisioin_result getResult(I iface, withCollisioin_args args) + throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + result.success = iface.withCollisioin(args.input); + return result; + } + } + + public static class noReturn + extends org.apache.thrift.ProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public noReturn_result getResult(I iface, noReturn_args args) + throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + iface.noReturn(args.delay); + return result; + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.ProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayHasArgs_args args) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay); + return null; + } + } + + public static class oneWay + extends org.apache.thrift.ProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public org.apache.thrift.TBase getResult(I iface, oneWay_args args) + throws org.apache.thrift.TException { + iface.oneWay(); + return null; + } + } + + public static class oneWayWithError + extends org.apache.thrift.ProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayWithError_args args) + throws org.apache.thrift.TException { + iface.oneWayWithError(); + return null; + } + } + + public static class data + extends org.apache.thrift.ProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public data_result getResult(I iface, data_args args) throws org.apache.thrift.TException { + data_result result = new data_result(); + result.success = iface.data(args.user, args.account); + return result; + } + } + } + + public static class AsyncProcessor + extends org.apache.thrift.TBaseAsyncProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(AsyncProcessor.class.getName()); + + public AsyncProcessor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>>())); + } + + protected AsyncProcessor( + I iface, + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction> + getProcessMap( + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.AsyncProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + sayHello_result result = new sayHello_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + sayHello_result result = new sayHello_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + sayHello_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.sayHello(args.zone, args.name, resultHandler); + } + } + + public static class withDelay + extends org.apache.thrift.AsyncProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withDelay_result result = new withDelay_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withDelay_result result = new withDelay_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withDelay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withDelay(args.delay, resultHandler); + } + } + + public static class withoutArgs + extends org.apache.thrift.AsyncProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withoutArgs_result result = new withoutArgs_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withoutArgs_result result = new withoutArgs_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withoutArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withoutArgs(resultHandler); + } + } + + public static class withError + extends org.apache.thrift.AsyncProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withError_result result = new withError_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withError_result result = new withError_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withError(resultHandler); + } + } + + public static class withCollisioin + extends org.apache.thrift.AsyncProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withCollisioin_result result = new withCollisioin_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withCollisioin_result result = new withCollisioin_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withCollisioin_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withCollisioin(args.input, resultHandler); + } + } + + public static class noReturn + extends org.apache.thrift.AsyncProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) { + noReturn_result result = new noReturn_result(); + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + noReturn_result result = new noReturn_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + noReturn_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.noReturn(args.delay, resultHandler); + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.AsyncProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWayHasArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay, resultHandler); + } + } + + public static class oneWay + extends org.apache.thrift.AsyncProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWay(resultHandler); + } + } + + public static class oneWayWithError + extends org.apache.thrift.AsyncProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWayWithError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayWithError(resultHandler); + } + } + + public static class data + extends org.apache.thrift.AsyncProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(UserAccount o) { + data_result result = new data_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + data_result result = new data_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + data_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.data(args.user, args.account, resultHandler); + } + } + } + + public static class sayHello_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_args"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String zone; // required + public @org.apache.thrift.annotation.Nullable java.lang.String name; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + NAME((short) 2, "name"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // NAME + return NAME; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_args.class, metaDataMap); + } + + public sayHello_args() {} + + public sayHello_args(java.lang.String zone, java.lang.String name) { + this(); + this.zone = zone; + this.name = name; + } + + /** Performs a deep copy on other. */ + public sayHello_args(sayHello_args other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetName()) { + this.name = other.name; + } + } + + public sayHello_args deepCopy() { + return new sayHello_args(this); + } + + @Override + public void clear() { + this.zone = null; + this.name = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getZone() { + return this.zone; + } + + public sayHello_args setZone(@org.apache.thrift.annotation.Nullable java.lang.String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getName() { + return this.name; + } + + public sayHello_args setName(@org.apache.thrift.annotation.Nullable java.lang.String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((java.lang.String) value); + } + break; + + case NAME: + if (value == null) { + unsetName(); + } else { + setName((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case NAME: + return getName(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case NAME: + return isSetName(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof sayHello_args) return this.equals((sayHello_args) that); + return false; + } + + public boolean equals(sayHello_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetZone()).compareTo(other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.valueOf(isSetName()).compareTo(other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("sayHello_args("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_argsStandardScheme getScheme() { + return new sayHello_argsStandardScheme(); + } + } + + private static class sayHello_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_argsTupleScheme getScheme() { + return new sayHello_argsTupleScheme(); + } + } + + private static class sayHello_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetZone()) { + optionals.set(0); + } + if (struct.isSetName()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetZone()) { + oprot.writeString(struct.zone); + } + if (struct.isSetName()) { + oprot.writeString(struct.name); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } + if (incoming.get(1)) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class sayHello_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_result.class, metaDataMap); + } + + public sayHello_result() {} + + public sayHello_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public sayHello_result(sayHello_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public sayHello_result deepCopy() { + return new sayHello_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public sayHello_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof sayHello_result) return this.equals((sayHello_result) that); + return false; + } + + public boolean equals(sayHello_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("sayHello_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_resultStandardScheme getScheme() { + return new sayHello_resultStandardScheme(); + } + } + + private static class sayHello_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_resultTupleScheme getScheme() { + return new sayHello_resultTupleScheme(); + } + } + + private static class sayHello_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withDelay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_args.class, metaDataMap); + } + + public withDelay_args() {} + + public withDelay_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public withDelay_args(withDelay_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public withDelay_args deepCopy() { + return new withDelay_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public withDelay_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withDelay_args) return this.equals((withDelay_args) that); + return false; + } + + public boolean equals(withDelay_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(withDelay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withDelay_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_argsStandardScheme getScheme() { + return new withDelay_argsStandardScheme(); + } + } + + private static class withDelay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_argsTupleScheme getScheme() { + return new withDelay_argsTupleScheme(); + } + } + + private static class withDelay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withDelay_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_result.class, metaDataMap); + } + + public withDelay_result() {} + + public withDelay_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withDelay_result(withDelay_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withDelay_result deepCopy() { + return new withDelay_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withDelay_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withDelay_result) return this.equals((withDelay_result) that); + return false; + } + + public boolean equals(withDelay_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withDelay_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withDelay_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_resultStandardScheme getScheme() { + return new withDelay_resultStandardScheme(); + } + } + + private static class withDelay_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_resultTupleScheme getScheme() { + return new withDelay_resultTupleScheme(); + } + } + + private static class withDelay_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withoutArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_args.class, metaDataMap); + } + + public withoutArgs_args() {} + + /** Performs a deep copy on other. */ + public withoutArgs_args(withoutArgs_args other) {} + + public withoutArgs_args deepCopy() { + return new withoutArgs_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withoutArgs_args) return this.equals((withoutArgs_args) that); + return false; + } + + public boolean equals(withoutArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withoutArgs_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_argsStandardScheme getScheme() { + return new withoutArgs_argsStandardScheme(); + } + } + + private static class withoutArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_argsTupleScheme getScheme() { + return new withoutArgs_argsTupleScheme(); + } + } + + private static class withoutArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withoutArgs_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_result.class, metaDataMap); + } + + public withoutArgs_result() {} + + public withoutArgs_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withoutArgs_result(withoutArgs_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withoutArgs_result deepCopy() { + return new withoutArgs_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withoutArgs_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withoutArgs_result) return this.equals((withoutArgs_result) that); + return false; + } + + public boolean equals(withoutArgs_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withoutArgs_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_resultStandardScheme getScheme() { + return new withoutArgs_resultStandardScheme(); + } + } + + private static class withoutArgs_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_resultTupleScheme getScheme() { + return new withoutArgs_resultTupleScheme(); + } + } + + private static class withoutArgs_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_args.class, metaDataMap); + } + + public withError_args() {} + + /** Performs a deep copy on other. */ + public withError_args(withError_args other) {} + + public withError_args deepCopy() { + return new withError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withError_args) return this.equals((withError_args) that); + return false; + } + + public boolean equals(withError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_argsStandardScheme getScheme() { + return new withError_argsStandardScheme(); + } + } + + private static class withError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_argsTupleScheme getScheme() { + return new withError_argsTupleScheme(); + } + } + + private static class withError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withError_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_result.class, metaDataMap); + } + + public withError_result() {} + + public withError_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withError_result(withError_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withError_result deepCopy() { + return new withError_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withError_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withError_result) return this.equals((withError_result) that); + return false; + } + + public boolean equals(withError_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withError_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withError_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_resultStandardScheme getScheme() { + return new withError_resultStandardScheme(); + } + } + + private static class withError_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_resultTupleScheme getScheme() { + return new withError_resultTupleScheme(); + } + } + + private static class withError_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withCollisioin_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_args"); + + private static final org.apache.thrift.protocol.TField INPUT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "input", org.apache.thrift.protocol.TType.STRING, (short) 3333); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String input; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + INPUT((short) 3333, "input"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 3333: // INPUT + return INPUT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.INPUT, + new org.apache.thrift.meta_data.FieldMetaData( + "input", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_args.class, metaDataMap); + } + + public withCollisioin_args() {} + + public withCollisioin_args(java.lang.String input) { + this(); + this.input = input; + } + + /** Performs a deep copy on other. */ + public withCollisioin_args(withCollisioin_args other) { + if (other.isSetInput()) { + this.input = other.input; + } + } + + public withCollisioin_args deepCopy() { + return new withCollisioin_args(this); + } + + @Override + public void clear() { + this.input = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getInput() { + return this.input; + } + + public withCollisioin_args setInput( + @org.apache.thrift.annotation.Nullable java.lang.String input) { + this.input = input; + return this; + } + + public void unsetInput() { + this.input = null; + } + + /** Returns true if field input is set (has been assigned a value) and false otherwise */ + public boolean isSetInput() { + return this.input != null; + } + + public void setInputIsSet(boolean value) { + if (!value) { + this.input = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case INPUT: + if (value == null) { + unsetInput(); + } else { + setInput((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case INPUT: + return getInput(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case INPUT: + return isSetInput(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withCollisioin_args) return this.equals((withCollisioin_args) that); + return false; + } + + public boolean equals(withCollisioin_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_input = true && this.isSetInput(); + boolean that_present_input = true && that.isSetInput(); + if (this_present_input || that_present_input) { + if (!(this_present_input && that_present_input)) return false; + if (!this.input.equals(that.input)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetInput()) ? 131071 : 524287); + if (isSetInput()) hashCode = hashCode * 8191 + input.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetInput()).compareTo(other.isSetInput()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInput()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.input, other.input); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withCollisioin_args("); + boolean first = true; + + sb.append("input:"); + if (this.input == null) { + sb.append("null"); + } else { + sb.append(this.input); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_argsStandardScheme getScheme() { + return new withCollisioin_argsStandardScheme(); + } + } + + private static class withCollisioin_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 3333: // INPUT + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.input != null) { + oprot.writeFieldBegin(INPUT_FIELD_DESC); + oprot.writeString(struct.input); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_argsTupleScheme getScheme() { + return new withCollisioin_argsTupleScheme(); + } + } + + private static class withCollisioin_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetInput()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetInput()) { + oprot.writeString(struct.input); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withCollisioin_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_result.class, metaDataMap); + } + + public withCollisioin_result() {} + + public withCollisioin_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withCollisioin_result(withCollisioin_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withCollisioin_result deepCopy() { + return new withCollisioin_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withCollisioin_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof withCollisioin_result) return this.equals((withCollisioin_result) that); + return false; + } + + public boolean equals(withCollisioin_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withCollisioin_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_resultStandardScheme getScheme() { + return new withCollisioin_resultStandardScheme(); + } + } + + private static class withCollisioin_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_resultTupleScheme getScheme() { + return new withCollisioin_resultTupleScheme(); + } + } + + private static class withCollisioin_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class noReturn_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_args.class, metaDataMap); + } + + public noReturn_args() {} + + public noReturn_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public noReturn_args(noReturn_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public noReturn_args deepCopy() { + return new noReturn_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public noReturn_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof noReturn_args) return this.equals((noReturn_args) that); + return false; + } + + public boolean equals(noReturn_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(noReturn_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("noReturn_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_argsStandardScheme getScheme() { + return new noReturn_argsStandardScheme(); + } + } + + private static class noReturn_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_argsTupleScheme getScheme() { + return new noReturn_argsTupleScheme(); + } + } + + private static class noReturn_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class noReturn_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_result"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_resultTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_result.class, metaDataMap); + } + + public noReturn_result() {} + + /** Performs a deep copy on other. */ + public noReturn_result(noReturn_result other) {} + + public noReturn_result deepCopy() { + return new noReturn_result(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof noReturn_result) return this.equals((noReturn_result) that); + return false; + } + + public boolean equals(noReturn_result that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(noReturn_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("noReturn_result("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_resultStandardScheme getScheme() { + return new noReturn_resultStandardScheme(); + } + } + + private static class noReturn_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_resultTupleScheme getScheme() { + return new noReturn_resultTupleScheme(); + } + } + + private static class noReturn_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class oneWayHasArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayHasArgs_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayHasArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayHasArgs_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayHasArgs_args.class, metaDataMap); + } + + public oneWayHasArgs_args() {} + + public oneWayHasArgs_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public oneWayHasArgs_args(oneWayHasArgs_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public oneWayHasArgs_args deepCopy() { + return new oneWayHasArgs_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public oneWayHasArgs_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof oneWayHasArgs_args) return this.equals((oneWayHasArgs_args) that); + return false; + } + + public boolean equals(oneWayHasArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(oneWayHasArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWayHasArgs_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayHasArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayHasArgs_argsStandardScheme getScheme() { + return new oneWayHasArgs_argsStandardScheme(); + } + } + + private static class oneWayHasArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayHasArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayHasArgs_argsTupleScheme getScheme() { + return new oneWayHasArgs_argsTupleScheme(); + } + } + + private static class oneWayHasArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class oneWay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWay_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWay_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWay_args.class, metaDataMap); + } + + public oneWay_args() {} + + /** Performs a deep copy on other. */ + public oneWay_args(oneWay_args other) {} + + public oneWay_args deepCopy() { + return new oneWay_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof oneWay_args) return this.equals((oneWay_args) that); + return false; + } + + public boolean equals(oneWay_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWay_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWay_argsStandardScheme getScheme() { + return new oneWay_argsStandardScheme(); + } + } + + private static class oneWay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWay_argsTupleScheme getScheme() { + return new oneWay_argsTupleScheme(); + } + } + + private static class oneWay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class oneWayWithError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayWithError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayWithError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayWithError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayWithError_args.class, metaDataMap); + } + + public oneWayWithError_args() {} + + /** Performs a deep copy on other. */ + public oneWayWithError_args(oneWayWithError_args other) {} + + public oneWayWithError_args deepCopy() { + return new oneWayWithError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof oneWayWithError_args) return this.equals((oneWayWithError_args) that); + return false; + } + + public boolean equals(oneWayWithError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWayWithError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWayWithError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayWithError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayWithError_argsStandardScheme getScheme() { + return new oneWayWithError_argsStandardScheme(); + } + } + + private static class oneWayWithError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayWithError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayWithError_argsTupleScheme getScheme() { + return new oneWayWithError_argsTupleScheme(); + } + } + + private static class oneWayWithError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class data_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_args"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable User user; // required + public @org.apache.thrift.annotation.Nullable Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(data_args.class, metaDataMap); + } + + public data_args() {} + + public data_args(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public data_args(data_args other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public data_args deepCopy() { + return new data_args(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + @org.apache.thrift.annotation.Nullable + public User getUser() { + return this.user; + } + + public data_args setUser(@org.apache.thrift.annotation.Nullable User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + @org.apache.thrift.annotation.Nullable + public Account getAccount() { + return this.account; + } + + public data_args setAccount(@org.apache.thrift.annotation.Nullable Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof data_args) return this.equals((data_args) that); + return false; + } + + public boolean equals(data_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetUser()).compareTo(other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.valueOf(isSetAccount()).compareTo(other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("data_args("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_argsStandardScheme getScheme() { + return new data_argsStandardScheme(); + } + } + + private static class data_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_argsTupleScheme getScheme() { + return new data_argsTupleScheme(); + } + } + + private static class data_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetUser()) { + optionals.set(0); + } + if (struct.isSetAccount()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetUser()) { + struct.user.write(oprot); + } + if (struct.isSetAccount()) { + struct.account.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } + if (incoming.get(1)) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class data_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRUCT, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable UserAccount success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, UserAccount.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + data_result.class, metaDataMap); + } + + public data_result() {} + + public data_result(UserAccount success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public data_result(data_result other) { + if (other.isSetSuccess()) { + this.success = new UserAccount(other.success); + } + } + + public data_result deepCopy() { + return new data_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public UserAccount getSuccess() { + return this.success; + } + + public data_result setSuccess(@org.apache.thrift.annotation.Nullable UserAccount success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((UserAccount) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof data_result) return this.equals((data_result) that); + return false; + } + + public boolean equals(data_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("data_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_resultStandardScheme getScheme() { + return new data_resultStandardScheme(); + } + } + + private static class data_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_resultTupleScheme getScheme() { + return new data_resultTupleScheme(); + } + } + + private static class data_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_13_0/User.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_13_0/User.java new file mode 100644 index 000000000000..aff33280bf2a --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_13_0/User.java @@ -0,0 +1,597 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_13_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.13.0)", + date = "2025-02-27") +public class User + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("User"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "userId", org.apache.thrift.protocol.TType.STRING, (short) 2); + private static final org.apache.thrift.protocol.TField AGE_FIELD_DESC = + new org.apache.thrift.protocol.TField("age", org.apache.thrift.protocol.TType.I32, (short) 3); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String name; // required + public @org.apache.thrift.annotation.Nullable java.lang.String userId; // required + public int age; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + NAME((short) 1, "name"), + USER_ID((short) 2, "userId"), + AGE((short) 3, "age"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // NAME + return NAME; + case 2: // USER_ID + return USER_ID; + case 3: // AGE + return AGE; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __AGE_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.USER_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "userId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.AGE, + new org.apache.thrift.meta_data.FieldMetaData( + "age", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(User.class, metaDataMap); + } + + public User() {} + + public User(java.lang.String name, java.lang.String userId, int age) { + this(); + this.name = name; + this.userId = userId; + this.age = age; + setAgeIsSet(true); + } + + /** Performs a deep copy on other. */ + public User(User other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetName()) { + this.name = other.name; + } + if (other.isSetUserId()) { + this.userId = other.userId; + } + this.age = other.age; + } + + public User deepCopy() { + return new User(this); + } + + @Override + public void clear() { + this.name = null; + this.userId = null; + setAgeIsSet(false); + this.age = 0; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getName() { + return this.name; + } + + public User setName(@org.apache.thrift.annotation.Nullable java.lang.String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getUserId() { + return this.userId; + } + + public User setUserId(@org.apache.thrift.annotation.Nullable java.lang.String userId) { + this.userId = userId; + return this; + } + + public void unsetUserId() { + this.userId = null; + } + + /** Returns true if field userId is set (has been assigned a value) and false otherwise */ + public boolean isSetUserId() { + return this.userId != null; + } + + public void setUserIdIsSet(boolean value) { + if (!value) { + this.userId = null; + } + } + + public int getAge() { + return this.age; + } + + public User setAge(int age) { + this.age = age; + setAgeIsSet(true); + return this; + } + + public void unsetAge() { + __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __AGE_ISSET_ID); + } + + /** Returns true if field age is set (has been assigned a value) and false otherwise */ + public boolean isSetAge() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __AGE_ISSET_ID); + } + + public void setAgeIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __AGE_ISSET_ID, value); + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case NAME: + if (value == null) { + unsetName(); + } else { + setName((java.lang.String) value); + } + break; + + case USER_ID: + if (value == null) { + unsetUserId(); + } else { + setUserId((java.lang.String) value); + } + break; + + case AGE: + if (value == null) { + unsetAge(); + } else { + setAge((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case NAME: + return getName(); + + case USER_ID: + return getUserId(); + + case AGE: + return getAge(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case NAME: + return isSetName(); + case USER_ID: + return isSetUserId(); + case AGE: + return isSetAge(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof User) return this.equals((User) that); + return false; + } + + public boolean equals(User that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + boolean this_present_userId = true && this.isSetUserId(); + boolean that_present_userId = true && that.isSetUserId(); + if (this_present_userId || that_present_userId) { + if (!(this_present_userId && that_present_userId)) return false; + if (!this.userId.equals(that.userId)) return false; + } + + boolean this_present_age = true; + boolean that_present_age = true; + if (this_present_age || that_present_age) { + if (!(this_present_age && that_present_age)) return false; + if (this.age != that.age) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + hashCode = hashCode * 8191 + ((isSetUserId()) ? 131071 : 524287); + if (isSetUserId()) hashCode = hashCode * 8191 + userId.hashCode(); + + hashCode = hashCode * 8191 + age; + + return hashCode; + } + + @Override + public int compareTo(User other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetName()).compareTo(other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.valueOf(isSetUserId()).compareTo(other.isSetUserId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.valueOf(isSetAge()).compareTo(other.isSetAge()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAge()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.age, other.age); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("User("); + boolean first = true; + + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + if (!first) sb.append(", "); + sb.append("userId:"); + if (this.userId == null) { + sb.append("null"); + } else { + sb.append(this.userId); + } + first = false; + if (!first) sb.append(", "); + sb.append("age:"); + sb.append(this.age); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (name == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'name' was not present! Struct: " + toString()); + } + if (userId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'userId' was not present! Struct: " + toString()); + } + // alas, we cannot check 'age' because it's a primitive and you chose the non-beans generator. + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public UserStandardScheme getScheme() { + return new UserStandardScheme(); + } + } + + private static class UserStandardScheme extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // AGE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + if (!struct.isSetAge()) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'age' was not found in serialized data! Struct: " + toString()); + } + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, User struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + if (struct.userId != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userId); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(AGE_FIELD_DESC); + oprot.writeI32(struct.age); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public UserTupleScheme getScheme() { + return new UserTupleScheme(); + } + } + + private static class UserTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.name); + oprot.writeString(struct.userId); + oprot.writeI32(struct.age); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.name = iprot.readString(); + struct.setNameIsSet(true); + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_13_0/UserAccount.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_13_0/UserAccount.java new file mode 100644 index 000000000000..165f980fef0d --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_13_0/UserAccount.java @@ -0,0 +1,508 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_13_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.13.0)", + date = "2025-02-27") +public class UserAccount + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("UserAccount"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserAccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserAccountTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable User user; // required + public @org.apache.thrift.annotation.Nullable Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserAccount.class, metaDataMap); + } + + public UserAccount() {} + + public UserAccount(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public UserAccount(UserAccount other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public UserAccount deepCopy() { + return new UserAccount(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + @org.apache.thrift.annotation.Nullable + public User getUser() { + return this.user; + } + + public UserAccount setUser(@org.apache.thrift.annotation.Nullable User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + @org.apache.thrift.annotation.Nullable + public Account getAccount() { + return this.account; + } + + public UserAccount setAccount(@org.apache.thrift.annotation.Nullable Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that == null) return false; + if (that instanceof UserAccount) return this.equals((UserAccount) that); + return false; + } + + public boolean equals(UserAccount that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(UserAccount other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.valueOf(isSetUser()).compareTo(other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.valueOf(isSetAccount()).compareTo(other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("UserAccount("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (user == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'user' was not present! Struct: " + toString()); + } + if (account == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'account' was not present! Struct: " + toString()); + } + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserAccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public UserAccountStandardScheme getScheme() { + return new UserAccountStandardScheme(); + } + } + + private static class UserAccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, UserAccount struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserAccountTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public UserAccountTupleScheme getScheme() { + return new UserAccountTupleScheme(); + } + } + + private static class UserAccountTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user.write(oprot); + struct.account.write(oprot); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_0/Account.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_0/Account.java new file mode 100644 index 000000000000..24b1c065d30e --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_0/Account.java @@ -0,0 +1,495 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_14_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.14.0)", + date = "2025-02-27") +public class Account + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("Account"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField CARD_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "cardId", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new AccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new AccountTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String zone; // required + public @org.apache.thrift.annotation.Nullable java.lang.String cardId; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + CARD_ID((short) 2, "cardId"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // CARD_ID + return CARD_ID; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.CARD_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "cardId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Account.class, metaDataMap); + } + + public Account() {} + + public Account(java.lang.String zone, java.lang.String cardId) { + this(); + this.zone = zone; + this.cardId = cardId; + } + + /** Performs a deep copy on other. */ + public Account(Account other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetCardId()) { + this.cardId = other.cardId; + } + } + + public Account deepCopy() { + return new Account(this); + } + + @Override + public void clear() { + this.zone = null; + this.cardId = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getZone() { + return this.zone; + } + + public Account setZone(@org.apache.thrift.annotation.Nullable java.lang.String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getCardId() { + return this.cardId; + } + + public Account setCardId(@org.apache.thrift.annotation.Nullable java.lang.String cardId) { + this.cardId = cardId; + return this; + } + + public void unsetCardId() { + this.cardId = null; + } + + /** Returns true if field cardId is set (has been assigned a value) and false otherwise */ + public boolean isSetCardId() { + return this.cardId != null; + } + + public void setCardIdIsSet(boolean value) { + if (!value) { + this.cardId = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((java.lang.String) value); + } + break; + + case CARD_ID: + if (value == null) { + unsetCardId(); + } else { + setCardId((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case CARD_ID: + return getCardId(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case CARD_ID: + return isSetCardId(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof Account) return this.equals((Account) that); + return false; + } + + public boolean equals(Account that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_cardId = true && this.isSetCardId(); + boolean that_present_cardId = true && that.isSetCardId(); + if (this_present_cardId || that_present_cardId) { + if (!(this_present_cardId && that_present_cardId)) return false; + if (!this.cardId.equals(that.cardId)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetCardId()) ? 131071 : 524287); + if (isSetCardId()) hashCode = hashCode * 8191 + cardId.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(Account other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetZone(), other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetCardId(), other.isSetCardId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCardId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cardId, other.cardId); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("Account("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("cardId:"); + if (this.cardId == null) { + sb.append("null"); + } else { + sb.append(this.cardId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (zone == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'zone' was not present! Struct: " + toString()); + } + if (cardId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'cardId' was not present! Struct: " + toString()); + } + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class AccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public AccountStandardScheme getScheme() { + return new AccountStandardScheme(); + } + } + + private static class AccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // CARD_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, Account struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.cardId != null) { + oprot.writeFieldBegin(CARD_ID_FIELD_DESC); + oprot.writeString(struct.cardId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class AccountTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public AccountTupleScheme getScheme() { + return new AccountTupleScheme(); + } + } + + private static class AccountTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.zone); + oprot.writeString(struct.cardId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_0/ThriftService.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_0/ThriftService.java new file mode 100644 index 000000000000..572d233a74e1 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_0/ThriftService.java @@ -0,0 +1,8110 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_14_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.14.0)", + date = "2025-02-27") +public class ThriftService { + + public interface Iface { + + public java.lang.String sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException; + + public java.lang.String withDelay(int delay) throws org.apache.thrift.TException; + + public java.lang.String withoutArgs() throws org.apache.thrift.TException; + + public java.lang.String withError() throws org.apache.thrift.TException; + + public java.lang.String withCollisioin(java.lang.String input) + throws org.apache.thrift.TException; + + public void noReturn(int delay) throws org.apache.thrift.TException; + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException; + + public void oneWay() throws org.apache.thrift.TException; + + public void oneWayWithError() throws org.apache.thrift.TException; + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException; + } + + public interface AsyncIface { + + public void sayHello( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withCollisioin( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + } + + public static class Client extends org.apache.thrift.TServiceClient implements Iface { + public static class Factory implements org.apache.thrift.TServiceClientFactory { + public Factory() {} + + public Client getClient(org.apache.thrift.protocol.TProtocol prot) { + return new Client(prot); + } + + public Client getClient( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + return new Client(iprot, oprot); + } + } + + public Client(org.apache.thrift.protocol.TProtocol prot) { + super(prot, prot); + } + + public Client( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + super(iprot, oprot); + } + + public java.lang.String sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException { + send_sayHello(zone, name); + return recv_sayHello(); + } + + public void send_sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException { + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + sendBase("sayHello", args); + } + + public java.lang.String recv_sayHello() throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + receiveBase(result, "sayHello"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "sayHello failed: unknown result"); + } + + public java.lang.String withDelay(int delay) throws org.apache.thrift.TException { + send_withDelay(delay); + return recv_withDelay(); + } + + public void send_withDelay(int delay) throws org.apache.thrift.TException { + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + sendBase("withDelay", args); + } + + public java.lang.String recv_withDelay() throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + receiveBase(result, "withDelay"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withDelay failed: unknown result"); + } + + public java.lang.String withoutArgs() throws org.apache.thrift.TException { + send_withoutArgs(); + return recv_withoutArgs(); + } + + public void send_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_args args = new withoutArgs_args(); + sendBase("withoutArgs", args); + } + + public java.lang.String recv_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + receiveBase(result, "withoutArgs"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withoutArgs failed: unknown result"); + } + + public java.lang.String withError() throws org.apache.thrift.TException { + send_withError(); + return recv_withError(); + } + + public void send_withError() throws org.apache.thrift.TException { + withError_args args = new withError_args(); + sendBase("withError", args); + } + + public java.lang.String recv_withError() throws org.apache.thrift.TException { + withError_result result = new withError_result(); + receiveBase(result, "withError"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withError failed: unknown result"); + } + + public java.lang.String withCollisioin(java.lang.String input) + throws org.apache.thrift.TException { + send_withCollisioin(input); + return recv_withCollisioin(); + } + + public void send_withCollisioin(java.lang.String input) throws org.apache.thrift.TException { + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + sendBase("withCollisioin", args); + } + + public java.lang.String recv_withCollisioin() throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + receiveBase(result, "withCollisioin"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withCollisioin failed: unknown result"); + } + + public void noReturn(int delay) throws org.apache.thrift.TException { + send_noReturn(delay); + recv_noReturn(); + } + + public void send_noReturn(int delay) throws org.apache.thrift.TException { + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + sendBase("noReturn", args); + } + + public void recv_noReturn() throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + receiveBase(result, "noReturn"); + return; + } + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException { + send_oneWayHasArgs(delay); + } + + public void send_oneWayHasArgs(int delay) throws org.apache.thrift.TException { + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + sendBaseOneway("oneWayHasArgs", args); + } + + public void oneWay() throws org.apache.thrift.TException { + send_oneWay(); + } + + public void send_oneWay() throws org.apache.thrift.TException { + oneWay_args args = new oneWay_args(); + sendBaseOneway("oneWay", args); + } + + public void oneWayWithError() throws org.apache.thrift.TException { + send_oneWayWithError(); + } + + public void send_oneWayWithError() throws org.apache.thrift.TException { + oneWayWithError_args args = new oneWayWithError_args(); + sendBaseOneway("oneWayWithError", args); + } + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException { + send_data(user, account); + return recv_data(); + } + + public void send_data(User user, Account account) throws org.apache.thrift.TException { + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + sendBase("data", args); + } + + public UserAccount recv_data() throws org.apache.thrift.TException { + data_result result = new data_result(); + receiveBase(result, "data"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, "data failed: unknown result"); + } + } + + public static class AsyncClient extends org.apache.thrift.async.TAsyncClient + implements AsyncIface { + public static class Factory + implements org.apache.thrift.async.TAsyncClientFactory { + private org.apache.thrift.async.TAsyncClientManager clientManager; + private org.apache.thrift.protocol.TProtocolFactory protocolFactory; + + public Factory( + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.protocol.TProtocolFactory protocolFactory) { + this.clientManager = clientManager; + this.protocolFactory = protocolFactory; + } + + public AsyncClient getAsyncClient( + org.apache.thrift.transport.TNonblockingTransport transport) { + return new AsyncClient(protocolFactory, clientManager, transport); + } + } + + public AsyncClient( + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.transport.TNonblockingTransport transport) { + super(protocolFactory, clientManager, transport); + } + + public void sayHello( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + sayHello_call method_call = + new sayHello_call(zone, name, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class sayHello_call + extends org.apache.thrift.async.TAsyncMethodCall { + private java.lang.String zone; + private java.lang.String name; + + public sayHello_call( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.zone = zone; + this.name = name; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "sayHello", org.apache.thrift.protocol.TMessageType.CALL, 0)); + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_sayHello(); + } + } + + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withDelay_call method_call = + new withDelay_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withDelay_call + extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public withDelay_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withDelay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withDelay(); + } + } + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withoutArgs_call method_call = + new withoutArgs_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withoutArgs_call + extends org.apache.thrift.async.TAsyncMethodCall { + public withoutArgs_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withoutArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withoutArgs_args args = new withoutArgs_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withoutArgs(); + } + } + + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withError_call method_call = + new withError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withError_call + extends org.apache.thrift.async.TAsyncMethodCall { + public withError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withError_args args = new withError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withError(); + } + } + + public void withCollisioin( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withCollisioin_call method_call = + new withCollisioin_call(input, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withCollisioin_call + extends org.apache.thrift.async.TAsyncMethodCall { + private java.lang.String input; + + public withCollisioin_call( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.input = input; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withCollisioin", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withCollisioin(); + } + } + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + noReturn_call method_call = + new noReturn_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class noReturn_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public noReturn_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "noReturn", org.apache.thrift.protocol.TMessageType.CALL, 0)); + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayHasArgs_call method_call = + new oneWayHasArgs_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayHasArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public oneWayHasArgs_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayHasArgs", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWay_call method_call = + new oneWay_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWay_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWay_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWay", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWay_args args = new oneWay_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayWithError_call method_call = + new oneWayWithError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayWithError_call + extends org.apache.thrift.async.TAsyncMethodCall { + public oneWayWithError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayWithError", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayWithError_args args = new oneWayWithError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + data_call method_call = + new data_call(user, account, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class data_call extends org.apache.thrift.async.TAsyncMethodCall { + private User user; + private Account account; + + public data_call( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.user = user; + this.account = account; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "data", org.apache.thrift.protocol.TMessageType.CALL, 0)); + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + args.write(prot); + prot.writeMessageEnd(); + } + + public UserAccount getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_data(); + } + } + } + + public static class Processor extends org.apache.thrift.TBaseProcessor + implements org.apache.thrift.TProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(Processor.class.getName()); + + public Processor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + java.lang.String, + org.apache.thrift.ProcessFunction>())); + } + + protected Processor( + I iface, + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + getProcessMap( + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.ProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public sayHello_result getResult(I iface, sayHello_args args) + throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + result.success = iface.sayHello(args.zone, args.name); + return result; + } + } + + public static class withDelay + extends org.apache.thrift.ProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withDelay_result getResult(I iface, withDelay_args args) + throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + result.success = iface.withDelay(args.delay); + return result; + } + } + + public static class withoutArgs + extends org.apache.thrift.ProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withoutArgs_result getResult(I iface, withoutArgs_args args) + throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + result.success = iface.withoutArgs(); + return result; + } + } + + public static class withError + extends org.apache.thrift.ProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withError_result getResult(I iface, withError_args args) + throws org.apache.thrift.TException { + withError_result result = new withError_result(); + result.success = iface.withError(); + return result; + } + } + + public static class withCollisioin + extends org.apache.thrift.ProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withCollisioin_result getResult(I iface, withCollisioin_args args) + throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + result.success = iface.withCollisioin(args.input); + return result; + } + } + + public static class noReturn + extends org.apache.thrift.ProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public noReturn_result getResult(I iface, noReturn_args args) + throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + iface.noReturn(args.delay); + return result; + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.ProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayHasArgs_args args) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay); + return null; + } + } + + public static class oneWay + extends org.apache.thrift.ProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public org.apache.thrift.TBase getResult(I iface, oneWay_args args) + throws org.apache.thrift.TException { + iface.oneWay(); + return null; + } + } + + public static class oneWayWithError + extends org.apache.thrift.ProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayWithError_args args) + throws org.apache.thrift.TException { + iface.oneWayWithError(); + return null; + } + } + + public static class data + extends org.apache.thrift.ProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public data_result getResult(I iface, data_args args) throws org.apache.thrift.TException { + data_result result = new data_result(); + result.success = iface.data(args.user, args.account); + return result; + } + } + } + + public static class AsyncProcessor + extends org.apache.thrift.TBaseAsyncProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(AsyncProcessor.class.getName()); + + public AsyncProcessor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>>())); + } + + protected AsyncProcessor( + I iface, + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction> + getProcessMap( + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.AsyncProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + sayHello_result result = new sayHello_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + sayHello_result result = new sayHello_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + sayHello_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.sayHello(args.zone, args.name, resultHandler); + } + } + + public static class withDelay + extends org.apache.thrift.AsyncProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withDelay_result result = new withDelay_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withDelay_result result = new withDelay_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withDelay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withDelay(args.delay, resultHandler); + } + } + + public static class withoutArgs + extends org.apache.thrift.AsyncProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withoutArgs_result result = new withoutArgs_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withoutArgs_result result = new withoutArgs_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withoutArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withoutArgs(resultHandler); + } + } + + public static class withError + extends org.apache.thrift.AsyncProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withError_result result = new withError_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withError_result result = new withError_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withError(resultHandler); + } + } + + public static class withCollisioin + extends org.apache.thrift.AsyncProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withCollisioin_result result = new withCollisioin_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withCollisioin_result result = new withCollisioin_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withCollisioin_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withCollisioin(args.input, resultHandler); + } + } + + public static class noReturn + extends org.apache.thrift.AsyncProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) { + noReturn_result result = new noReturn_result(); + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + noReturn_result result = new noReturn_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + noReturn_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.noReturn(args.delay, resultHandler); + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.AsyncProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWayHasArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay, resultHandler); + } + } + + public static class oneWay + extends org.apache.thrift.AsyncProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWay(resultHandler); + } + } + + public static class oneWayWithError + extends org.apache.thrift.AsyncProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWayWithError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayWithError(resultHandler); + } + } + + public static class data + extends org.apache.thrift.AsyncProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(UserAccount o) { + data_result result = new data_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + data_result result = new data_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + data_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.data(args.user, args.account, resultHandler); + } + } + } + + public static class sayHello_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_args"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String zone; // required + public @org.apache.thrift.annotation.Nullable java.lang.String name; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + NAME((short) 2, "name"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // NAME + return NAME; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_args.class, metaDataMap); + } + + public sayHello_args() {} + + public sayHello_args(java.lang.String zone, java.lang.String name) { + this(); + this.zone = zone; + this.name = name; + } + + /** Performs a deep copy on other. */ + public sayHello_args(sayHello_args other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetName()) { + this.name = other.name; + } + } + + public sayHello_args deepCopy() { + return new sayHello_args(this); + } + + @Override + public void clear() { + this.zone = null; + this.name = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getZone() { + return this.zone; + } + + public sayHello_args setZone(@org.apache.thrift.annotation.Nullable java.lang.String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getName() { + return this.name; + } + + public sayHello_args setName(@org.apache.thrift.annotation.Nullable java.lang.String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((java.lang.String) value); + } + break; + + case NAME: + if (value == null) { + unsetName(); + } else { + setName((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case NAME: + return getName(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case NAME: + return isSetName(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof sayHello_args) return this.equals((sayHello_args) that); + return false; + } + + public boolean equals(sayHello_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetZone(), other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetName(), other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("sayHello_args("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_argsStandardScheme getScheme() { + return new sayHello_argsStandardScheme(); + } + } + + private static class sayHello_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_argsTupleScheme getScheme() { + return new sayHello_argsTupleScheme(); + } + } + + private static class sayHello_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetZone()) { + optionals.set(0); + } + if (struct.isSetName()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetZone()) { + oprot.writeString(struct.zone); + } + if (struct.isSetName()) { + oprot.writeString(struct.name); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } + if (incoming.get(1)) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class sayHello_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_result.class, metaDataMap); + } + + public sayHello_result() {} + + public sayHello_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public sayHello_result(sayHello_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public sayHello_result deepCopy() { + return new sayHello_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public sayHello_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof sayHello_result) return this.equals((sayHello_result) that); + return false; + } + + public boolean equals(sayHello_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("sayHello_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_resultStandardScheme getScheme() { + return new sayHello_resultStandardScheme(); + } + } + + private static class sayHello_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_resultTupleScheme getScheme() { + return new sayHello_resultTupleScheme(); + } + } + + private static class sayHello_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withDelay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_args.class, metaDataMap); + } + + public withDelay_args() {} + + public withDelay_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public withDelay_args(withDelay_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public withDelay_args deepCopy() { + return new withDelay_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public withDelay_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withDelay_args) return this.equals((withDelay_args) that); + return false; + } + + public boolean equals(withDelay_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(withDelay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withDelay_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_argsStandardScheme getScheme() { + return new withDelay_argsStandardScheme(); + } + } + + private static class withDelay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_argsTupleScheme getScheme() { + return new withDelay_argsTupleScheme(); + } + } + + private static class withDelay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withDelay_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_result.class, metaDataMap); + } + + public withDelay_result() {} + + public withDelay_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withDelay_result(withDelay_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withDelay_result deepCopy() { + return new withDelay_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withDelay_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withDelay_result) return this.equals((withDelay_result) that); + return false; + } + + public boolean equals(withDelay_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withDelay_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withDelay_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_resultStandardScheme getScheme() { + return new withDelay_resultStandardScheme(); + } + } + + private static class withDelay_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_resultTupleScheme getScheme() { + return new withDelay_resultTupleScheme(); + } + } + + private static class withDelay_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withoutArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_args.class, metaDataMap); + } + + public withoutArgs_args() {} + + /** Performs a deep copy on other. */ + public withoutArgs_args(withoutArgs_args other) {} + + public withoutArgs_args deepCopy() { + return new withoutArgs_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withoutArgs_args) return this.equals((withoutArgs_args) that); + return false; + } + + public boolean equals(withoutArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withoutArgs_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_argsStandardScheme getScheme() { + return new withoutArgs_argsStandardScheme(); + } + } + + private static class withoutArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_argsTupleScheme getScheme() { + return new withoutArgs_argsTupleScheme(); + } + } + + private static class withoutArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withoutArgs_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_result.class, metaDataMap); + } + + public withoutArgs_result() {} + + public withoutArgs_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withoutArgs_result(withoutArgs_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withoutArgs_result deepCopy() { + return new withoutArgs_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withoutArgs_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withoutArgs_result) return this.equals((withoutArgs_result) that); + return false; + } + + public boolean equals(withoutArgs_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withoutArgs_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_resultStandardScheme getScheme() { + return new withoutArgs_resultStandardScheme(); + } + } + + private static class withoutArgs_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_resultTupleScheme getScheme() { + return new withoutArgs_resultTupleScheme(); + } + } + + private static class withoutArgs_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_args.class, metaDataMap); + } + + public withError_args() {} + + /** Performs a deep copy on other. */ + public withError_args(withError_args other) {} + + public withError_args deepCopy() { + return new withError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withError_args) return this.equals((withError_args) that); + return false; + } + + public boolean equals(withError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_argsStandardScheme getScheme() { + return new withError_argsStandardScheme(); + } + } + + private static class withError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_argsTupleScheme getScheme() { + return new withError_argsTupleScheme(); + } + } + + private static class withError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withError_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_result.class, metaDataMap); + } + + public withError_result() {} + + public withError_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withError_result(withError_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withError_result deepCopy() { + return new withError_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withError_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withError_result) return this.equals((withError_result) that); + return false; + } + + public boolean equals(withError_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withError_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withError_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_resultStandardScheme getScheme() { + return new withError_resultStandardScheme(); + } + } + + private static class withError_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_resultTupleScheme getScheme() { + return new withError_resultTupleScheme(); + } + } + + private static class withError_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withCollisioin_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_args"); + + private static final org.apache.thrift.protocol.TField INPUT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "input", org.apache.thrift.protocol.TType.STRING, (short) 3333); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String input; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + INPUT((short) 3333, "input"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 3333: // INPUT + return INPUT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.INPUT, + new org.apache.thrift.meta_data.FieldMetaData( + "input", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_args.class, metaDataMap); + } + + public withCollisioin_args() {} + + public withCollisioin_args(java.lang.String input) { + this(); + this.input = input; + } + + /** Performs a deep copy on other. */ + public withCollisioin_args(withCollisioin_args other) { + if (other.isSetInput()) { + this.input = other.input; + } + } + + public withCollisioin_args deepCopy() { + return new withCollisioin_args(this); + } + + @Override + public void clear() { + this.input = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getInput() { + return this.input; + } + + public withCollisioin_args setInput( + @org.apache.thrift.annotation.Nullable java.lang.String input) { + this.input = input; + return this; + } + + public void unsetInput() { + this.input = null; + } + + /** Returns true if field input is set (has been assigned a value) and false otherwise */ + public boolean isSetInput() { + return this.input != null; + } + + public void setInputIsSet(boolean value) { + if (!value) { + this.input = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case INPUT: + if (value == null) { + unsetInput(); + } else { + setInput((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case INPUT: + return getInput(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case INPUT: + return isSetInput(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withCollisioin_args) return this.equals((withCollisioin_args) that); + return false; + } + + public boolean equals(withCollisioin_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_input = true && this.isSetInput(); + boolean that_present_input = true && that.isSetInput(); + if (this_present_input || that_present_input) { + if (!(this_present_input && that_present_input)) return false; + if (!this.input.equals(that.input)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetInput()) ? 131071 : 524287); + if (isSetInput()) hashCode = hashCode * 8191 + input.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetInput(), other.isSetInput()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInput()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.input, other.input); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withCollisioin_args("); + boolean first = true; + + sb.append("input:"); + if (this.input == null) { + sb.append("null"); + } else { + sb.append(this.input); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_argsStandardScheme getScheme() { + return new withCollisioin_argsStandardScheme(); + } + } + + private static class withCollisioin_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 3333: // INPUT + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.input != null) { + oprot.writeFieldBegin(INPUT_FIELD_DESC); + oprot.writeString(struct.input); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_argsTupleScheme getScheme() { + return new withCollisioin_argsTupleScheme(); + } + } + + private static class withCollisioin_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetInput()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetInput()) { + oprot.writeString(struct.input); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withCollisioin_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_result.class, metaDataMap); + } + + public withCollisioin_result() {} + + public withCollisioin_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withCollisioin_result(withCollisioin_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withCollisioin_result deepCopy() { + return new withCollisioin_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withCollisioin_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withCollisioin_result) return this.equals((withCollisioin_result) that); + return false; + } + + public boolean equals(withCollisioin_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withCollisioin_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_resultStandardScheme getScheme() { + return new withCollisioin_resultStandardScheme(); + } + } + + private static class withCollisioin_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_resultTupleScheme getScheme() { + return new withCollisioin_resultTupleScheme(); + } + } + + private static class withCollisioin_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class noReturn_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_args.class, metaDataMap); + } + + public noReturn_args() {} + + public noReturn_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public noReturn_args(noReturn_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public noReturn_args deepCopy() { + return new noReturn_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public noReturn_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof noReturn_args) return this.equals((noReturn_args) that); + return false; + } + + public boolean equals(noReturn_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(noReturn_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("noReturn_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_argsStandardScheme getScheme() { + return new noReturn_argsStandardScheme(); + } + } + + private static class noReturn_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_argsTupleScheme getScheme() { + return new noReturn_argsTupleScheme(); + } + } + + private static class noReturn_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class noReturn_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_result"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_resultTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_result.class, metaDataMap); + } + + public noReturn_result() {} + + /** Performs a deep copy on other. */ + public noReturn_result(noReturn_result other) {} + + public noReturn_result deepCopy() { + return new noReturn_result(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof noReturn_result) return this.equals((noReturn_result) that); + return false; + } + + public boolean equals(noReturn_result that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(noReturn_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("noReturn_result("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_resultStandardScheme getScheme() { + return new noReturn_resultStandardScheme(); + } + } + + private static class noReturn_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_resultTupleScheme getScheme() { + return new noReturn_resultTupleScheme(); + } + } + + private static class noReturn_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class oneWayHasArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayHasArgs_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayHasArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayHasArgs_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayHasArgs_args.class, metaDataMap); + } + + public oneWayHasArgs_args() {} + + public oneWayHasArgs_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public oneWayHasArgs_args(oneWayHasArgs_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public oneWayHasArgs_args deepCopy() { + return new oneWayHasArgs_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public oneWayHasArgs_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWayHasArgs_args) return this.equals((oneWayHasArgs_args) that); + return false; + } + + public boolean equals(oneWayHasArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(oneWayHasArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWayHasArgs_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayHasArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayHasArgs_argsStandardScheme getScheme() { + return new oneWayHasArgs_argsStandardScheme(); + } + } + + private static class oneWayHasArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayHasArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayHasArgs_argsTupleScheme getScheme() { + return new oneWayHasArgs_argsTupleScheme(); + } + } + + private static class oneWayHasArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class oneWay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWay_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWay_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWay_args.class, metaDataMap); + } + + public oneWay_args() {} + + /** Performs a deep copy on other. */ + public oneWay_args(oneWay_args other) {} + + public oneWay_args deepCopy() { + return new oneWay_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWay_args) return this.equals((oneWay_args) that); + return false; + } + + public boolean equals(oneWay_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWay_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWay_argsStandardScheme getScheme() { + return new oneWay_argsStandardScheme(); + } + } + + private static class oneWay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWay_argsTupleScheme getScheme() { + return new oneWay_argsTupleScheme(); + } + } + + private static class oneWay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class oneWayWithError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayWithError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayWithError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayWithError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayWithError_args.class, metaDataMap); + } + + public oneWayWithError_args() {} + + /** Performs a deep copy on other. */ + public oneWayWithError_args(oneWayWithError_args other) {} + + public oneWayWithError_args deepCopy() { + return new oneWayWithError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWayWithError_args) return this.equals((oneWayWithError_args) that); + return false; + } + + public boolean equals(oneWayWithError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWayWithError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWayWithError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayWithError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayWithError_argsStandardScheme getScheme() { + return new oneWayWithError_argsStandardScheme(); + } + } + + private static class oneWayWithError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayWithError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayWithError_argsTupleScheme getScheme() { + return new oneWayWithError_argsTupleScheme(); + } + } + + private static class oneWayWithError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class data_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_args"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable User user; // required + public @org.apache.thrift.annotation.Nullable Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(data_args.class, metaDataMap); + } + + public data_args() {} + + public data_args(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public data_args(data_args other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public data_args deepCopy() { + return new data_args(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + @org.apache.thrift.annotation.Nullable + public User getUser() { + return this.user; + } + + public data_args setUser(@org.apache.thrift.annotation.Nullable User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + @org.apache.thrift.annotation.Nullable + public Account getAccount() { + return this.account; + } + + public data_args setAccount(@org.apache.thrift.annotation.Nullable Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof data_args) return this.equals((data_args) that); + return false; + } + + public boolean equals(data_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetUser(), other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAccount(), other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("data_args("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_argsStandardScheme getScheme() { + return new data_argsStandardScheme(); + } + } + + private static class data_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_argsTupleScheme getScheme() { + return new data_argsTupleScheme(); + } + } + + private static class data_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetUser()) { + optionals.set(0); + } + if (struct.isSetAccount()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetUser()) { + struct.user.write(oprot); + } + if (struct.isSetAccount()) { + struct.account.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } + if (incoming.get(1)) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class data_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRUCT, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable UserAccount success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, UserAccount.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + data_result.class, metaDataMap); + } + + public data_result() {} + + public data_result(UserAccount success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public data_result(data_result other) { + if (other.isSetSuccess()) { + this.success = new UserAccount(other.success); + } + } + + public data_result deepCopy() { + return new data_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public UserAccount getSuccess() { + return this.success; + } + + public data_result setSuccess(@org.apache.thrift.annotation.Nullable UserAccount success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((UserAccount) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof data_result) return this.equals((data_result) that); + return false; + } + + public boolean equals(data_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("data_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_resultStandardScheme getScheme() { + return new data_resultStandardScheme(); + } + } + + private static class data_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_resultTupleScheme getScheme() { + return new data_resultTupleScheme(); + } + } + + private static class data_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_0/User.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_0/User.java new file mode 100644 index 000000000000..928d1e461849 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_0/User.java @@ -0,0 +1,596 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_14_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.14.0)", + date = "2025-02-27") +public class User + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("User"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "userId", org.apache.thrift.protocol.TType.STRING, (short) 2); + private static final org.apache.thrift.protocol.TField AGE_FIELD_DESC = + new org.apache.thrift.protocol.TField("age", org.apache.thrift.protocol.TType.I32, (short) 3); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String name; // required + public @org.apache.thrift.annotation.Nullable java.lang.String userId; // required + public int age; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + NAME((short) 1, "name"), + USER_ID((short) 2, "userId"), + AGE((short) 3, "age"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // NAME + return NAME; + case 2: // USER_ID + return USER_ID; + case 3: // AGE + return AGE; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __AGE_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.USER_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "userId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.AGE, + new org.apache.thrift.meta_data.FieldMetaData( + "age", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(User.class, metaDataMap); + } + + public User() {} + + public User(java.lang.String name, java.lang.String userId, int age) { + this(); + this.name = name; + this.userId = userId; + this.age = age; + setAgeIsSet(true); + } + + /** Performs a deep copy on other. */ + public User(User other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetName()) { + this.name = other.name; + } + if (other.isSetUserId()) { + this.userId = other.userId; + } + this.age = other.age; + } + + public User deepCopy() { + return new User(this); + } + + @Override + public void clear() { + this.name = null; + this.userId = null; + setAgeIsSet(false); + this.age = 0; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getName() { + return this.name; + } + + public User setName(@org.apache.thrift.annotation.Nullable java.lang.String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getUserId() { + return this.userId; + } + + public User setUserId(@org.apache.thrift.annotation.Nullable java.lang.String userId) { + this.userId = userId; + return this; + } + + public void unsetUserId() { + this.userId = null; + } + + /** Returns true if field userId is set (has been assigned a value) and false otherwise */ + public boolean isSetUserId() { + return this.userId != null; + } + + public void setUserIdIsSet(boolean value) { + if (!value) { + this.userId = null; + } + } + + public int getAge() { + return this.age; + } + + public User setAge(int age) { + this.age = age; + setAgeIsSet(true); + return this; + } + + public void unsetAge() { + __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __AGE_ISSET_ID); + } + + /** Returns true if field age is set (has been assigned a value) and false otherwise */ + public boolean isSetAge() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __AGE_ISSET_ID); + } + + public void setAgeIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __AGE_ISSET_ID, value); + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case NAME: + if (value == null) { + unsetName(); + } else { + setName((java.lang.String) value); + } + break; + + case USER_ID: + if (value == null) { + unsetUserId(); + } else { + setUserId((java.lang.String) value); + } + break; + + case AGE: + if (value == null) { + unsetAge(); + } else { + setAge((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case NAME: + return getName(); + + case USER_ID: + return getUserId(); + + case AGE: + return getAge(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case NAME: + return isSetName(); + case USER_ID: + return isSetUserId(); + case AGE: + return isSetAge(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof User) return this.equals((User) that); + return false; + } + + public boolean equals(User that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + boolean this_present_userId = true && this.isSetUserId(); + boolean that_present_userId = true && that.isSetUserId(); + if (this_present_userId || that_present_userId) { + if (!(this_present_userId && that_present_userId)) return false; + if (!this.userId.equals(that.userId)) return false; + } + + boolean this_present_age = true; + boolean that_present_age = true; + if (this_present_age || that_present_age) { + if (!(this_present_age && that_present_age)) return false; + if (this.age != that.age) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + hashCode = hashCode * 8191 + ((isSetUserId()) ? 131071 : 524287); + if (isSetUserId()) hashCode = hashCode * 8191 + userId.hashCode(); + + hashCode = hashCode * 8191 + age; + + return hashCode; + } + + @Override + public int compareTo(User other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetName(), other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetUserId(), other.isSetUserId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAge(), other.isSetAge()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAge()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.age, other.age); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("User("); + boolean first = true; + + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + if (!first) sb.append(", "); + sb.append("userId:"); + if (this.userId == null) { + sb.append("null"); + } else { + sb.append(this.userId); + } + first = false; + if (!first) sb.append(", "); + sb.append("age:"); + sb.append(this.age); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (name == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'name' was not present! Struct: " + toString()); + } + if (userId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'userId' was not present! Struct: " + toString()); + } + // alas, we cannot check 'age' because it's a primitive and you chose the non-beans generator. + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public UserStandardScheme getScheme() { + return new UserStandardScheme(); + } + } + + private static class UserStandardScheme extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // AGE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + if (!struct.isSetAge()) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'age' was not found in serialized data! Struct: " + toString()); + } + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, User struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + if (struct.userId != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userId); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(AGE_FIELD_DESC); + oprot.writeI32(struct.age); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public UserTupleScheme getScheme() { + return new UserTupleScheme(); + } + } + + private static class UserTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.name); + oprot.writeString(struct.userId); + oprot.writeI32(struct.age); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.name = iprot.readString(); + struct.setNameIsSet(true); + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_0/UserAccount.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_0/UserAccount.java new file mode 100644 index 000000000000..e0c339e07c77 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_0/UserAccount.java @@ -0,0 +1,507 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_14_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.14.0)", + date = "2025-02-27") +public class UserAccount + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("UserAccount"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserAccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserAccountTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable User user; // required + public @org.apache.thrift.annotation.Nullable Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserAccount.class, metaDataMap); + } + + public UserAccount() {} + + public UserAccount(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public UserAccount(UserAccount other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public UserAccount deepCopy() { + return new UserAccount(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + @org.apache.thrift.annotation.Nullable + public User getUser() { + return this.user; + } + + public UserAccount setUser(@org.apache.thrift.annotation.Nullable User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + @org.apache.thrift.annotation.Nullable + public Account getAccount() { + return this.account; + } + + public UserAccount setAccount(@org.apache.thrift.annotation.Nullable Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof UserAccount) return this.equals((UserAccount) that); + return false; + } + + public boolean equals(UserAccount that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(UserAccount other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetUser(), other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAccount(), other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("UserAccount("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (user == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'user' was not present! Struct: " + toString()); + } + if (account == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'account' was not present! Struct: " + toString()); + } + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserAccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public UserAccountStandardScheme getScheme() { + return new UserAccountStandardScheme(); + } + } + + private static class UserAccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, UserAccount struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserAccountTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public UserAccountTupleScheme getScheme() { + return new UserAccountTupleScheme(); + } + } + + private static class UserAccountTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user.write(oprot); + struct.account.write(oprot); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_1/Account.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_1/Account.java new file mode 100644 index 000000000000..9174074cb2b9 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_1/Account.java @@ -0,0 +1,495 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_14_1; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.14.1)", + date = "2025-02-27") +public class Account + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("Account"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField CARD_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "cardId", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new AccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new AccountTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String zone; // required + public @org.apache.thrift.annotation.Nullable java.lang.String cardId; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + CARD_ID((short) 2, "cardId"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // CARD_ID + return CARD_ID; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.CARD_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "cardId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Account.class, metaDataMap); + } + + public Account() {} + + public Account(java.lang.String zone, java.lang.String cardId) { + this(); + this.zone = zone; + this.cardId = cardId; + } + + /** Performs a deep copy on other. */ + public Account(Account other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetCardId()) { + this.cardId = other.cardId; + } + } + + public Account deepCopy() { + return new Account(this); + } + + @Override + public void clear() { + this.zone = null; + this.cardId = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getZone() { + return this.zone; + } + + public Account setZone(@org.apache.thrift.annotation.Nullable java.lang.String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getCardId() { + return this.cardId; + } + + public Account setCardId(@org.apache.thrift.annotation.Nullable java.lang.String cardId) { + this.cardId = cardId; + return this; + } + + public void unsetCardId() { + this.cardId = null; + } + + /** Returns true if field cardId is set (has been assigned a value) and false otherwise */ + public boolean isSetCardId() { + return this.cardId != null; + } + + public void setCardIdIsSet(boolean value) { + if (!value) { + this.cardId = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((java.lang.String) value); + } + break; + + case CARD_ID: + if (value == null) { + unsetCardId(); + } else { + setCardId((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case CARD_ID: + return getCardId(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case CARD_ID: + return isSetCardId(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof Account) return this.equals((Account) that); + return false; + } + + public boolean equals(Account that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_cardId = true && this.isSetCardId(); + boolean that_present_cardId = true && that.isSetCardId(); + if (this_present_cardId || that_present_cardId) { + if (!(this_present_cardId && that_present_cardId)) return false; + if (!this.cardId.equals(that.cardId)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetCardId()) ? 131071 : 524287); + if (isSetCardId()) hashCode = hashCode * 8191 + cardId.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(Account other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetZone(), other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetCardId(), other.isSetCardId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCardId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cardId, other.cardId); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("Account("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("cardId:"); + if (this.cardId == null) { + sb.append("null"); + } else { + sb.append(this.cardId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (zone == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'zone' was not present! Struct: " + toString()); + } + if (cardId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'cardId' was not present! Struct: " + toString()); + } + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class AccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public AccountStandardScheme getScheme() { + return new AccountStandardScheme(); + } + } + + private static class AccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // CARD_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, Account struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.cardId != null) { + oprot.writeFieldBegin(CARD_ID_FIELD_DESC); + oprot.writeString(struct.cardId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class AccountTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public AccountTupleScheme getScheme() { + return new AccountTupleScheme(); + } + } + + private static class AccountTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.zone); + oprot.writeString(struct.cardId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_1/ThriftService.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_1/ThriftService.java new file mode 100644 index 000000000000..44e684c57b4c --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_1/ThriftService.java @@ -0,0 +1,8110 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_14_1; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.14.1)", + date = "2025-02-27") +public class ThriftService { + + public interface Iface { + + public java.lang.String sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException; + + public java.lang.String withDelay(int delay) throws org.apache.thrift.TException; + + public java.lang.String withoutArgs() throws org.apache.thrift.TException; + + public java.lang.String withError() throws org.apache.thrift.TException; + + public java.lang.String withCollisioin(java.lang.String input) + throws org.apache.thrift.TException; + + public void noReturn(int delay) throws org.apache.thrift.TException; + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException; + + public void oneWay() throws org.apache.thrift.TException; + + public void oneWayWithError() throws org.apache.thrift.TException; + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException; + } + + public interface AsyncIface { + + public void sayHello( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withCollisioin( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + } + + public static class Client extends org.apache.thrift.TServiceClient implements Iface { + public static class Factory implements org.apache.thrift.TServiceClientFactory { + public Factory() {} + + public Client getClient(org.apache.thrift.protocol.TProtocol prot) { + return new Client(prot); + } + + public Client getClient( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + return new Client(iprot, oprot); + } + } + + public Client(org.apache.thrift.protocol.TProtocol prot) { + super(prot, prot); + } + + public Client( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + super(iprot, oprot); + } + + public java.lang.String sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException { + send_sayHello(zone, name); + return recv_sayHello(); + } + + public void send_sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException { + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + sendBase("sayHello", args); + } + + public java.lang.String recv_sayHello() throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + receiveBase(result, "sayHello"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "sayHello failed: unknown result"); + } + + public java.lang.String withDelay(int delay) throws org.apache.thrift.TException { + send_withDelay(delay); + return recv_withDelay(); + } + + public void send_withDelay(int delay) throws org.apache.thrift.TException { + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + sendBase("withDelay", args); + } + + public java.lang.String recv_withDelay() throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + receiveBase(result, "withDelay"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withDelay failed: unknown result"); + } + + public java.lang.String withoutArgs() throws org.apache.thrift.TException { + send_withoutArgs(); + return recv_withoutArgs(); + } + + public void send_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_args args = new withoutArgs_args(); + sendBase("withoutArgs", args); + } + + public java.lang.String recv_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + receiveBase(result, "withoutArgs"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withoutArgs failed: unknown result"); + } + + public java.lang.String withError() throws org.apache.thrift.TException { + send_withError(); + return recv_withError(); + } + + public void send_withError() throws org.apache.thrift.TException { + withError_args args = new withError_args(); + sendBase("withError", args); + } + + public java.lang.String recv_withError() throws org.apache.thrift.TException { + withError_result result = new withError_result(); + receiveBase(result, "withError"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withError failed: unknown result"); + } + + public java.lang.String withCollisioin(java.lang.String input) + throws org.apache.thrift.TException { + send_withCollisioin(input); + return recv_withCollisioin(); + } + + public void send_withCollisioin(java.lang.String input) throws org.apache.thrift.TException { + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + sendBase("withCollisioin", args); + } + + public java.lang.String recv_withCollisioin() throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + receiveBase(result, "withCollisioin"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withCollisioin failed: unknown result"); + } + + public void noReturn(int delay) throws org.apache.thrift.TException { + send_noReturn(delay); + recv_noReturn(); + } + + public void send_noReturn(int delay) throws org.apache.thrift.TException { + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + sendBase("noReturn", args); + } + + public void recv_noReturn() throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + receiveBase(result, "noReturn"); + return; + } + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException { + send_oneWayHasArgs(delay); + } + + public void send_oneWayHasArgs(int delay) throws org.apache.thrift.TException { + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + sendBaseOneway("oneWayHasArgs", args); + } + + public void oneWay() throws org.apache.thrift.TException { + send_oneWay(); + } + + public void send_oneWay() throws org.apache.thrift.TException { + oneWay_args args = new oneWay_args(); + sendBaseOneway("oneWay", args); + } + + public void oneWayWithError() throws org.apache.thrift.TException { + send_oneWayWithError(); + } + + public void send_oneWayWithError() throws org.apache.thrift.TException { + oneWayWithError_args args = new oneWayWithError_args(); + sendBaseOneway("oneWayWithError", args); + } + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException { + send_data(user, account); + return recv_data(); + } + + public void send_data(User user, Account account) throws org.apache.thrift.TException { + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + sendBase("data", args); + } + + public UserAccount recv_data() throws org.apache.thrift.TException { + data_result result = new data_result(); + receiveBase(result, "data"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, "data failed: unknown result"); + } + } + + public static class AsyncClient extends org.apache.thrift.async.TAsyncClient + implements AsyncIface { + public static class Factory + implements org.apache.thrift.async.TAsyncClientFactory { + private org.apache.thrift.async.TAsyncClientManager clientManager; + private org.apache.thrift.protocol.TProtocolFactory protocolFactory; + + public Factory( + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.protocol.TProtocolFactory protocolFactory) { + this.clientManager = clientManager; + this.protocolFactory = protocolFactory; + } + + public AsyncClient getAsyncClient( + org.apache.thrift.transport.TNonblockingTransport transport) { + return new AsyncClient(protocolFactory, clientManager, transport); + } + } + + public AsyncClient( + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.transport.TNonblockingTransport transport) { + super(protocolFactory, clientManager, transport); + } + + public void sayHello( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + sayHello_call method_call = + new sayHello_call(zone, name, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class sayHello_call + extends org.apache.thrift.async.TAsyncMethodCall { + private java.lang.String zone; + private java.lang.String name; + + public sayHello_call( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.zone = zone; + this.name = name; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "sayHello", org.apache.thrift.protocol.TMessageType.CALL, 0)); + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_sayHello(); + } + } + + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withDelay_call method_call = + new withDelay_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withDelay_call + extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public withDelay_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withDelay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withDelay(); + } + } + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withoutArgs_call method_call = + new withoutArgs_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withoutArgs_call + extends org.apache.thrift.async.TAsyncMethodCall { + public withoutArgs_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withoutArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withoutArgs_args args = new withoutArgs_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withoutArgs(); + } + } + + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withError_call method_call = + new withError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withError_call + extends org.apache.thrift.async.TAsyncMethodCall { + public withError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withError_args args = new withError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withError(); + } + } + + public void withCollisioin( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withCollisioin_call method_call = + new withCollisioin_call(input, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withCollisioin_call + extends org.apache.thrift.async.TAsyncMethodCall { + private java.lang.String input; + + public withCollisioin_call( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.input = input; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withCollisioin", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withCollisioin(); + } + } + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + noReturn_call method_call = + new noReturn_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class noReturn_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public noReturn_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "noReturn", org.apache.thrift.protocol.TMessageType.CALL, 0)); + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayHasArgs_call method_call = + new oneWayHasArgs_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayHasArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public oneWayHasArgs_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayHasArgs", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWay_call method_call = + new oneWay_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWay_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWay_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWay", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWay_args args = new oneWay_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayWithError_call method_call = + new oneWayWithError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayWithError_call + extends org.apache.thrift.async.TAsyncMethodCall { + public oneWayWithError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayWithError", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayWithError_args args = new oneWayWithError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + data_call method_call = + new data_call(user, account, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class data_call extends org.apache.thrift.async.TAsyncMethodCall { + private User user; + private Account account; + + public data_call( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.user = user; + this.account = account; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "data", org.apache.thrift.protocol.TMessageType.CALL, 0)); + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + args.write(prot); + prot.writeMessageEnd(); + } + + public UserAccount getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_data(); + } + } + } + + public static class Processor extends org.apache.thrift.TBaseProcessor + implements org.apache.thrift.TProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(Processor.class.getName()); + + public Processor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + java.lang.String, + org.apache.thrift.ProcessFunction>())); + } + + protected Processor( + I iface, + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + getProcessMap( + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.ProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public sayHello_result getResult(I iface, sayHello_args args) + throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + result.success = iface.sayHello(args.zone, args.name); + return result; + } + } + + public static class withDelay + extends org.apache.thrift.ProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withDelay_result getResult(I iface, withDelay_args args) + throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + result.success = iface.withDelay(args.delay); + return result; + } + } + + public static class withoutArgs + extends org.apache.thrift.ProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withoutArgs_result getResult(I iface, withoutArgs_args args) + throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + result.success = iface.withoutArgs(); + return result; + } + } + + public static class withError + extends org.apache.thrift.ProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withError_result getResult(I iface, withError_args args) + throws org.apache.thrift.TException { + withError_result result = new withError_result(); + result.success = iface.withError(); + return result; + } + } + + public static class withCollisioin + extends org.apache.thrift.ProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withCollisioin_result getResult(I iface, withCollisioin_args args) + throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + result.success = iface.withCollisioin(args.input); + return result; + } + } + + public static class noReturn + extends org.apache.thrift.ProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public noReturn_result getResult(I iface, noReturn_args args) + throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + iface.noReturn(args.delay); + return result; + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.ProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayHasArgs_args args) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay); + return null; + } + } + + public static class oneWay + extends org.apache.thrift.ProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public org.apache.thrift.TBase getResult(I iface, oneWay_args args) + throws org.apache.thrift.TException { + iface.oneWay(); + return null; + } + } + + public static class oneWayWithError + extends org.apache.thrift.ProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayWithError_args args) + throws org.apache.thrift.TException { + iface.oneWayWithError(); + return null; + } + } + + public static class data + extends org.apache.thrift.ProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public data_result getResult(I iface, data_args args) throws org.apache.thrift.TException { + data_result result = new data_result(); + result.success = iface.data(args.user, args.account); + return result; + } + } + } + + public static class AsyncProcessor + extends org.apache.thrift.TBaseAsyncProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(AsyncProcessor.class.getName()); + + public AsyncProcessor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>>())); + } + + protected AsyncProcessor( + I iface, + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction> + getProcessMap( + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.AsyncProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + sayHello_result result = new sayHello_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + sayHello_result result = new sayHello_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + sayHello_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.sayHello(args.zone, args.name, resultHandler); + } + } + + public static class withDelay + extends org.apache.thrift.AsyncProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withDelay_result result = new withDelay_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withDelay_result result = new withDelay_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withDelay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withDelay(args.delay, resultHandler); + } + } + + public static class withoutArgs + extends org.apache.thrift.AsyncProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withoutArgs_result result = new withoutArgs_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withoutArgs_result result = new withoutArgs_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withoutArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withoutArgs(resultHandler); + } + } + + public static class withError + extends org.apache.thrift.AsyncProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withError_result result = new withError_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withError_result result = new withError_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withError(resultHandler); + } + } + + public static class withCollisioin + extends org.apache.thrift.AsyncProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withCollisioin_result result = new withCollisioin_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withCollisioin_result result = new withCollisioin_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withCollisioin_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withCollisioin(args.input, resultHandler); + } + } + + public static class noReturn + extends org.apache.thrift.AsyncProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) { + noReturn_result result = new noReturn_result(); + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + noReturn_result result = new noReturn_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + noReturn_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.noReturn(args.delay, resultHandler); + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.AsyncProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWayHasArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay, resultHandler); + } + } + + public static class oneWay + extends org.apache.thrift.AsyncProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWay(resultHandler); + } + } + + public static class oneWayWithError + extends org.apache.thrift.AsyncProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWayWithError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayWithError(resultHandler); + } + } + + public static class data + extends org.apache.thrift.AsyncProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(UserAccount o) { + data_result result = new data_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + data_result result = new data_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + data_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.data(args.user, args.account, resultHandler); + } + } + } + + public static class sayHello_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_args"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String zone; // required + public @org.apache.thrift.annotation.Nullable java.lang.String name; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + NAME((short) 2, "name"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // NAME + return NAME; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_args.class, metaDataMap); + } + + public sayHello_args() {} + + public sayHello_args(java.lang.String zone, java.lang.String name) { + this(); + this.zone = zone; + this.name = name; + } + + /** Performs a deep copy on other. */ + public sayHello_args(sayHello_args other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetName()) { + this.name = other.name; + } + } + + public sayHello_args deepCopy() { + return new sayHello_args(this); + } + + @Override + public void clear() { + this.zone = null; + this.name = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getZone() { + return this.zone; + } + + public sayHello_args setZone(@org.apache.thrift.annotation.Nullable java.lang.String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getName() { + return this.name; + } + + public sayHello_args setName(@org.apache.thrift.annotation.Nullable java.lang.String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((java.lang.String) value); + } + break; + + case NAME: + if (value == null) { + unsetName(); + } else { + setName((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case NAME: + return getName(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case NAME: + return isSetName(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof sayHello_args) return this.equals((sayHello_args) that); + return false; + } + + public boolean equals(sayHello_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetZone(), other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetName(), other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("sayHello_args("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_argsStandardScheme getScheme() { + return new sayHello_argsStandardScheme(); + } + } + + private static class sayHello_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_argsTupleScheme getScheme() { + return new sayHello_argsTupleScheme(); + } + } + + private static class sayHello_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetZone()) { + optionals.set(0); + } + if (struct.isSetName()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetZone()) { + oprot.writeString(struct.zone); + } + if (struct.isSetName()) { + oprot.writeString(struct.name); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } + if (incoming.get(1)) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class sayHello_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_result.class, metaDataMap); + } + + public sayHello_result() {} + + public sayHello_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public sayHello_result(sayHello_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public sayHello_result deepCopy() { + return new sayHello_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public sayHello_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof sayHello_result) return this.equals((sayHello_result) that); + return false; + } + + public boolean equals(sayHello_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("sayHello_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_resultStandardScheme getScheme() { + return new sayHello_resultStandardScheme(); + } + } + + private static class sayHello_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_resultTupleScheme getScheme() { + return new sayHello_resultTupleScheme(); + } + } + + private static class sayHello_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withDelay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_args.class, metaDataMap); + } + + public withDelay_args() {} + + public withDelay_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public withDelay_args(withDelay_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public withDelay_args deepCopy() { + return new withDelay_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public withDelay_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withDelay_args) return this.equals((withDelay_args) that); + return false; + } + + public boolean equals(withDelay_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(withDelay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withDelay_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_argsStandardScheme getScheme() { + return new withDelay_argsStandardScheme(); + } + } + + private static class withDelay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_argsTupleScheme getScheme() { + return new withDelay_argsTupleScheme(); + } + } + + private static class withDelay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withDelay_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_result.class, metaDataMap); + } + + public withDelay_result() {} + + public withDelay_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withDelay_result(withDelay_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withDelay_result deepCopy() { + return new withDelay_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withDelay_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withDelay_result) return this.equals((withDelay_result) that); + return false; + } + + public boolean equals(withDelay_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withDelay_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withDelay_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_resultStandardScheme getScheme() { + return new withDelay_resultStandardScheme(); + } + } + + private static class withDelay_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_resultTupleScheme getScheme() { + return new withDelay_resultTupleScheme(); + } + } + + private static class withDelay_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withoutArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_args.class, metaDataMap); + } + + public withoutArgs_args() {} + + /** Performs a deep copy on other. */ + public withoutArgs_args(withoutArgs_args other) {} + + public withoutArgs_args deepCopy() { + return new withoutArgs_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withoutArgs_args) return this.equals((withoutArgs_args) that); + return false; + } + + public boolean equals(withoutArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withoutArgs_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_argsStandardScheme getScheme() { + return new withoutArgs_argsStandardScheme(); + } + } + + private static class withoutArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_argsTupleScheme getScheme() { + return new withoutArgs_argsTupleScheme(); + } + } + + private static class withoutArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withoutArgs_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_result.class, metaDataMap); + } + + public withoutArgs_result() {} + + public withoutArgs_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withoutArgs_result(withoutArgs_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withoutArgs_result deepCopy() { + return new withoutArgs_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withoutArgs_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withoutArgs_result) return this.equals((withoutArgs_result) that); + return false; + } + + public boolean equals(withoutArgs_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withoutArgs_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_resultStandardScheme getScheme() { + return new withoutArgs_resultStandardScheme(); + } + } + + private static class withoutArgs_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_resultTupleScheme getScheme() { + return new withoutArgs_resultTupleScheme(); + } + } + + private static class withoutArgs_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_args.class, metaDataMap); + } + + public withError_args() {} + + /** Performs a deep copy on other. */ + public withError_args(withError_args other) {} + + public withError_args deepCopy() { + return new withError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withError_args) return this.equals((withError_args) that); + return false; + } + + public boolean equals(withError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_argsStandardScheme getScheme() { + return new withError_argsStandardScheme(); + } + } + + private static class withError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_argsTupleScheme getScheme() { + return new withError_argsTupleScheme(); + } + } + + private static class withError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withError_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_result.class, metaDataMap); + } + + public withError_result() {} + + public withError_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withError_result(withError_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withError_result deepCopy() { + return new withError_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withError_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withError_result) return this.equals((withError_result) that); + return false; + } + + public boolean equals(withError_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withError_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withError_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_resultStandardScheme getScheme() { + return new withError_resultStandardScheme(); + } + } + + private static class withError_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_resultTupleScheme getScheme() { + return new withError_resultTupleScheme(); + } + } + + private static class withError_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withCollisioin_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_args"); + + private static final org.apache.thrift.protocol.TField INPUT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "input", org.apache.thrift.protocol.TType.STRING, (short) 3333); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String input; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + INPUT((short) 3333, "input"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 3333: // INPUT + return INPUT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.INPUT, + new org.apache.thrift.meta_data.FieldMetaData( + "input", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_args.class, metaDataMap); + } + + public withCollisioin_args() {} + + public withCollisioin_args(java.lang.String input) { + this(); + this.input = input; + } + + /** Performs a deep copy on other. */ + public withCollisioin_args(withCollisioin_args other) { + if (other.isSetInput()) { + this.input = other.input; + } + } + + public withCollisioin_args deepCopy() { + return new withCollisioin_args(this); + } + + @Override + public void clear() { + this.input = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getInput() { + return this.input; + } + + public withCollisioin_args setInput( + @org.apache.thrift.annotation.Nullable java.lang.String input) { + this.input = input; + return this; + } + + public void unsetInput() { + this.input = null; + } + + /** Returns true if field input is set (has been assigned a value) and false otherwise */ + public boolean isSetInput() { + return this.input != null; + } + + public void setInputIsSet(boolean value) { + if (!value) { + this.input = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case INPUT: + if (value == null) { + unsetInput(); + } else { + setInput((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case INPUT: + return getInput(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case INPUT: + return isSetInput(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withCollisioin_args) return this.equals((withCollisioin_args) that); + return false; + } + + public boolean equals(withCollisioin_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_input = true && this.isSetInput(); + boolean that_present_input = true && that.isSetInput(); + if (this_present_input || that_present_input) { + if (!(this_present_input && that_present_input)) return false; + if (!this.input.equals(that.input)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetInput()) ? 131071 : 524287); + if (isSetInput()) hashCode = hashCode * 8191 + input.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetInput(), other.isSetInput()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInput()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.input, other.input); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withCollisioin_args("); + boolean first = true; + + sb.append("input:"); + if (this.input == null) { + sb.append("null"); + } else { + sb.append(this.input); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_argsStandardScheme getScheme() { + return new withCollisioin_argsStandardScheme(); + } + } + + private static class withCollisioin_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 3333: // INPUT + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.input != null) { + oprot.writeFieldBegin(INPUT_FIELD_DESC); + oprot.writeString(struct.input); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_argsTupleScheme getScheme() { + return new withCollisioin_argsTupleScheme(); + } + } + + private static class withCollisioin_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetInput()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetInput()) { + oprot.writeString(struct.input); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withCollisioin_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_result.class, metaDataMap); + } + + public withCollisioin_result() {} + + public withCollisioin_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withCollisioin_result(withCollisioin_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withCollisioin_result deepCopy() { + return new withCollisioin_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withCollisioin_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withCollisioin_result) return this.equals((withCollisioin_result) that); + return false; + } + + public boolean equals(withCollisioin_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withCollisioin_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_resultStandardScheme getScheme() { + return new withCollisioin_resultStandardScheme(); + } + } + + private static class withCollisioin_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_resultTupleScheme getScheme() { + return new withCollisioin_resultTupleScheme(); + } + } + + private static class withCollisioin_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class noReturn_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_args.class, metaDataMap); + } + + public noReturn_args() {} + + public noReturn_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public noReturn_args(noReturn_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public noReturn_args deepCopy() { + return new noReturn_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public noReturn_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof noReturn_args) return this.equals((noReturn_args) that); + return false; + } + + public boolean equals(noReturn_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(noReturn_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("noReturn_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_argsStandardScheme getScheme() { + return new noReturn_argsStandardScheme(); + } + } + + private static class noReturn_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_argsTupleScheme getScheme() { + return new noReturn_argsTupleScheme(); + } + } + + private static class noReturn_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class noReturn_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_result"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_resultTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_result.class, metaDataMap); + } + + public noReturn_result() {} + + /** Performs a deep copy on other. */ + public noReturn_result(noReturn_result other) {} + + public noReturn_result deepCopy() { + return new noReturn_result(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof noReturn_result) return this.equals((noReturn_result) that); + return false; + } + + public boolean equals(noReturn_result that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(noReturn_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("noReturn_result("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_resultStandardScheme getScheme() { + return new noReturn_resultStandardScheme(); + } + } + + private static class noReturn_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_resultTupleScheme getScheme() { + return new noReturn_resultTupleScheme(); + } + } + + private static class noReturn_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class oneWayHasArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayHasArgs_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayHasArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayHasArgs_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayHasArgs_args.class, metaDataMap); + } + + public oneWayHasArgs_args() {} + + public oneWayHasArgs_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public oneWayHasArgs_args(oneWayHasArgs_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public oneWayHasArgs_args deepCopy() { + return new oneWayHasArgs_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public oneWayHasArgs_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWayHasArgs_args) return this.equals((oneWayHasArgs_args) that); + return false; + } + + public boolean equals(oneWayHasArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(oneWayHasArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWayHasArgs_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayHasArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayHasArgs_argsStandardScheme getScheme() { + return new oneWayHasArgs_argsStandardScheme(); + } + } + + private static class oneWayHasArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayHasArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayHasArgs_argsTupleScheme getScheme() { + return new oneWayHasArgs_argsTupleScheme(); + } + } + + private static class oneWayHasArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class oneWay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWay_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWay_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWay_args.class, metaDataMap); + } + + public oneWay_args() {} + + /** Performs a deep copy on other. */ + public oneWay_args(oneWay_args other) {} + + public oneWay_args deepCopy() { + return new oneWay_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWay_args) return this.equals((oneWay_args) that); + return false; + } + + public boolean equals(oneWay_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWay_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWay_argsStandardScheme getScheme() { + return new oneWay_argsStandardScheme(); + } + } + + private static class oneWay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWay_argsTupleScheme getScheme() { + return new oneWay_argsTupleScheme(); + } + } + + private static class oneWay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class oneWayWithError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayWithError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayWithError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayWithError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayWithError_args.class, metaDataMap); + } + + public oneWayWithError_args() {} + + /** Performs a deep copy on other. */ + public oneWayWithError_args(oneWayWithError_args other) {} + + public oneWayWithError_args deepCopy() { + return new oneWayWithError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWayWithError_args) return this.equals((oneWayWithError_args) that); + return false; + } + + public boolean equals(oneWayWithError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWayWithError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWayWithError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayWithError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayWithError_argsStandardScheme getScheme() { + return new oneWayWithError_argsStandardScheme(); + } + } + + private static class oneWayWithError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayWithError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayWithError_argsTupleScheme getScheme() { + return new oneWayWithError_argsTupleScheme(); + } + } + + private static class oneWayWithError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class data_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_args"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable User user; // required + public @org.apache.thrift.annotation.Nullable Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(data_args.class, metaDataMap); + } + + public data_args() {} + + public data_args(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public data_args(data_args other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public data_args deepCopy() { + return new data_args(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + @org.apache.thrift.annotation.Nullable + public User getUser() { + return this.user; + } + + public data_args setUser(@org.apache.thrift.annotation.Nullable User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + @org.apache.thrift.annotation.Nullable + public Account getAccount() { + return this.account; + } + + public data_args setAccount(@org.apache.thrift.annotation.Nullable Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof data_args) return this.equals((data_args) that); + return false; + } + + public boolean equals(data_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetUser(), other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAccount(), other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("data_args("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_argsStandardScheme getScheme() { + return new data_argsStandardScheme(); + } + } + + private static class data_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_argsTupleScheme getScheme() { + return new data_argsTupleScheme(); + } + } + + private static class data_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetUser()) { + optionals.set(0); + } + if (struct.isSetAccount()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetUser()) { + struct.user.write(oprot); + } + if (struct.isSetAccount()) { + struct.account.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } + if (incoming.get(1)) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class data_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRUCT, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable UserAccount success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, UserAccount.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + data_result.class, metaDataMap); + } + + public data_result() {} + + public data_result(UserAccount success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public data_result(data_result other) { + if (other.isSetSuccess()) { + this.success = new UserAccount(other.success); + } + } + + public data_result deepCopy() { + return new data_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public UserAccount getSuccess() { + return this.success; + } + + public data_result setSuccess(@org.apache.thrift.annotation.Nullable UserAccount success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((UserAccount) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof data_result) return this.equals((data_result) that); + return false; + } + + public boolean equals(data_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("data_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_resultStandardScheme getScheme() { + return new data_resultStandardScheme(); + } + } + + private static class data_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_resultTupleScheme getScheme() { + return new data_resultTupleScheme(); + } + } + + private static class data_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_1/User.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_1/User.java new file mode 100644 index 000000000000..8a17e0a58910 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_1/User.java @@ -0,0 +1,596 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_14_1; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.14.1)", + date = "2025-02-27") +public class User + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("User"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "userId", org.apache.thrift.protocol.TType.STRING, (short) 2); + private static final org.apache.thrift.protocol.TField AGE_FIELD_DESC = + new org.apache.thrift.protocol.TField("age", org.apache.thrift.protocol.TType.I32, (short) 3); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String name; // required + public @org.apache.thrift.annotation.Nullable java.lang.String userId; // required + public int age; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + NAME((short) 1, "name"), + USER_ID((short) 2, "userId"), + AGE((short) 3, "age"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // NAME + return NAME; + case 2: // USER_ID + return USER_ID; + case 3: // AGE + return AGE; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __AGE_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.USER_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "userId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.AGE, + new org.apache.thrift.meta_data.FieldMetaData( + "age", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(User.class, metaDataMap); + } + + public User() {} + + public User(java.lang.String name, java.lang.String userId, int age) { + this(); + this.name = name; + this.userId = userId; + this.age = age; + setAgeIsSet(true); + } + + /** Performs a deep copy on other. */ + public User(User other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetName()) { + this.name = other.name; + } + if (other.isSetUserId()) { + this.userId = other.userId; + } + this.age = other.age; + } + + public User deepCopy() { + return new User(this); + } + + @Override + public void clear() { + this.name = null; + this.userId = null; + setAgeIsSet(false); + this.age = 0; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getName() { + return this.name; + } + + public User setName(@org.apache.thrift.annotation.Nullable java.lang.String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getUserId() { + return this.userId; + } + + public User setUserId(@org.apache.thrift.annotation.Nullable java.lang.String userId) { + this.userId = userId; + return this; + } + + public void unsetUserId() { + this.userId = null; + } + + /** Returns true if field userId is set (has been assigned a value) and false otherwise */ + public boolean isSetUserId() { + return this.userId != null; + } + + public void setUserIdIsSet(boolean value) { + if (!value) { + this.userId = null; + } + } + + public int getAge() { + return this.age; + } + + public User setAge(int age) { + this.age = age; + setAgeIsSet(true); + return this; + } + + public void unsetAge() { + __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __AGE_ISSET_ID); + } + + /** Returns true if field age is set (has been assigned a value) and false otherwise */ + public boolean isSetAge() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __AGE_ISSET_ID); + } + + public void setAgeIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __AGE_ISSET_ID, value); + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case NAME: + if (value == null) { + unsetName(); + } else { + setName((java.lang.String) value); + } + break; + + case USER_ID: + if (value == null) { + unsetUserId(); + } else { + setUserId((java.lang.String) value); + } + break; + + case AGE: + if (value == null) { + unsetAge(); + } else { + setAge((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case NAME: + return getName(); + + case USER_ID: + return getUserId(); + + case AGE: + return getAge(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case NAME: + return isSetName(); + case USER_ID: + return isSetUserId(); + case AGE: + return isSetAge(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof User) return this.equals((User) that); + return false; + } + + public boolean equals(User that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + boolean this_present_userId = true && this.isSetUserId(); + boolean that_present_userId = true && that.isSetUserId(); + if (this_present_userId || that_present_userId) { + if (!(this_present_userId && that_present_userId)) return false; + if (!this.userId.equals(that.userId)) return false; + } + + boolean this_present_age = true; + boolean that_present_age = true; + if (this_present_age || that_present_age) { + if (!(this_present_age && that_present_age)) return false; + if (this.age != that.age) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + hashCode = hashCode * 8191 + ((isSetUserId()) ? 131071 : 524287); + if (isSetUserId()) hashCode = hashCode * 8191 + userId.hashCode(); + + hashCode = hashCode * 8191 + age; + + return hashCode; + } + + @Override + public int compareTo(User other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetName(), other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetUserId(), other.isSetUserId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAge(), other.isSetAge()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAge()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.age, other.age); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("User("); + boolean first = true; + + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + if (!first) sb.append(", "); + sb.append("userId:"); + if (this.userId == null) { + sb.append("null"); + } else { + sb.append(this.userId); + } + first = false; + if (!first) sb.append(", "); + sb.append("age:"); + sb.append(this.age); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (name == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'name' was not present! Struct: " + toString()); + } + if (userId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'userId' was not present! Struct: " + toString()); + } + // alas, we cannot check 'age' because it's a primitive and you chose the non-beans generator. + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public UserStandardScheme getScheme() { + return new UserStandardScheme(); + } + } + + private static class UserStandardScheme extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // AGE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + if (!struct.isSetAge()) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'age' was not found in serialized data! Struct: " + toString()); + } + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, User struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + if (struct.userId != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userId); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(AGE_FIELD_DESC); + oprot.writeI32(struct.age); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public UserTupleScheme getScheme() { + return new UserTupleScheme(); + } + } + + private static class UserTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.name); + oprot.writeString(struct.userId); + oprot.writeI32(struct.age); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.name = iprot.readString(); + struct.setNameIsSet(true); + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_1/UserAccount.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_1/UserAccount.java new file mode 100644 index 000000000000..6a32aa7a368a --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_1/UserAccount.java @@ -0,0 +1,507 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_14_1; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.14.1)", + date = "2025-02-27") +public class UserAccount + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("UserAccount"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserAccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserAccountTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable User user; // required + public @org.apache.thrift.annotation.Nullable Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserAccount.class, metaDataMap); + } + + public UserAccount() {} + + public UserAccount(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public UserAccount(UserAccount other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public UserAccount deepCopy() { + return new UserAccount(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + @org.apache.thrift.annotation.Nullable + public User getUser() { + return this.user; + } + + public UserAccount setUser(@org.apache.thrift.annotation.Nullable User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + @org.apache.thrift.annotation.Nullable + public Account getAccount() { + return this.account; + } + + public UserAccount setAccount(@org.apache.thrift.annotation.Nullable Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof UserAccount) return this.equals((UserAccount) that); + return false; + } + + public boolean equals(UserAccount that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(UserAccount other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetUser(), other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAccount(), other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("UserAccount("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (user == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'user' was not present! Struct: " + toString()); + } + if (account == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'account' was not present! Struct: " + toString()); + } + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserAccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public UserAccountStandardScheme getScheme() { + return new UserAccountStandardScheme(); + } + } + + private static class UserAccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, UserAccount struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserAccountTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public UserAccountTupleScheme getScheme() { + return new UserAccountTupleScheme(); + } + } + + private static class UserAccountTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user.write(oprot); + struct.account.write(oprot); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_2/Account.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_2/Account.java new file mode 100644 index 000000000000..d827bc16feb5 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_2/Account.java @@ -0,0 +1,495 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_14_2; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.14.2)", + date = "2025-02-27") +public class Account + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("Account"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField CARD_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "cardId", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new AccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new AccountTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String zone; // required + public @org.apache.thrift.annotation.Nullable java.lang.String cardId; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + CARD_ID((short) 2, "cardId"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // CARD_ID + return CARD_ID; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.CARD_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "cardId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Account.class, metaDataMap); + } + + public Account() {} + + public Account(java.lang.String zone, java.lang.String cardId) { + this(); + this.zone = zone; + this.cardId = cardId; + } + + /** Performs a deep copy on other. */ + public Account(Account other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetCardId()) { + this.cardId = other.cardId; + } + } + + public Account deepCopy() { + return new Account(this); + } + + @Override + public void clear() { + this.zone = null; + this.cardId = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getZone() { + return this.zone; + } + + public Account setZone(@org.apache.thrift.annotation.Nullable java.lang.String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getCardId() { + return this.cardId; + } + + public Account setCardId(@org.apache.thrift.annotation.Nullable java.lang.String cardId) { + this.cardId = cardId; + return this; + } + + public void unsetCardId() { + this.cardId = null; + } + + /** Returns true if field cardId is set (has been assigned a value) and false otherwise */ + public boolean isSetCardId() { + return this.cardId != null; + } + + public void setCardIdIsSet(boolean value) { + if (!value) { + this.cardId = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((java.lang.String) value); + } + break; + + case CARD_ID: + if (value == null) { + unsetCardId(); + } else { + setCardId((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case CARD_ID: + return getCardId(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case CARD_ID: + return isSetCardId(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof Account) return this.equals((Account) that); + return false; + } + + public boolean equals(Account that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_cardId = true && this.isSetCardId(); + boolean that_present_cardId = true && that.isSetCardId(); + if (this_present_cardId || that_present_cardId) { + if (!(this_present_cardId && that_present_cardId)) return false; + if (!this.cardId.equals(that.cardId)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetCardId()) ? 131071 : 524287); + if (isSetCardId()) hashCode = hashCode * 8191 + cardId.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(Account other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetZone(), other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetCardId(), other.isSetCardId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCardId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cardId, other.cardId); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("Account("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("cardId:"); + if (this.cardId == null) { + sb.append("null"); + } else { + sb.append(this.cardId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (zone == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'zone' was not present! Struct: " + toString()); + } + if (cardId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'cardId' was not present! Struct: " + toString()); + } + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class AccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public AccountStandardScheme getScheme() { + return new AccountStandardScheme(); + } + } + + private static class AccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // CARD_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, Account struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.cardId != null) { + oprot.writeFieldBegin(CARD_ID_FIELD_DESC); + oprot.writeString(struct.cardId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class AccountTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public AccountTupleScheme getScheme() { + return new AccountTupleScheme(); + } + } + + private static class AccountTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.zone); + oprot.writeString(struct.cardId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_2/ThriftService.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_2/ThriftService.java new file mode 100644 index 000000000000..969640e0e8cd --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_2/ThriftService.java @@ -0,0 +1,8110 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_14_2; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.14.2)", + date = "2025-02-27") +public class ThriftService { + + public interface Iface { + + public java.lang.String sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException; + + public java.lang.String withDelay(int delay) throws org.apache.thrift.TException; + + public java.lang.String withoutArgs() throws org.apache.thrift.TException; + + public java.lang.String withError() throws org.apache.thrift.TException; + + public java.lang.String withCollisioin(java.lang.String input) + throws org.apache.thrift.TException; + + public void noReturn(int delay) throws org.apache.thrift.TException; + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException; + + public void oneWay() throws org.apache.thrift.TException; + + public void oneWayWithError() throws org.apache.thrift.TException; + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException; + } + + public interface AsyncIface { + + public void sayHello( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withCollisioin( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + } + + public static class Client extends org.apache.thrift.TServiceClient implements Iface { + public static class Factory implements org.apache.thrift.TServiceClientFactory { + public Factory() {} + + public Client getClient(org.apache.thrift.protocol.TProtocol prot) { + return new Client(prot); + } + + public Client getClient( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + return new Client(iprot, oprot); + } + } + + public Client(org.apache.thrift.protocol.TProtocol prot) { + super(prot, prot); + } + + public Client( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + super(iprot, oprot); + } + + public java.lang.String sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException { + send_sayHello(zone, name); + return recv_sayHello(); + } + + public void send_sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException { + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + sendBase("sayHello", args); + } + + public java.lang.String recv_sayHello() throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + receiveBase(result, "sayHello"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "sayHello failed: unknown result"); + } + + public java.lang.String withDelay(int delay) throws org.apache.thrift.TException { + send_withDelay(delay); + return recv_withDelay(); + } + + public void send_withDelay(int delay) throws org.apache.thrift.TException { + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + sendBase("withDelay", args); + } + + public java.lang.String recv_withDelay() throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + receiveBase(result, "withDelay"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withDelay failed: unknown result"); + } + + public java.lang.String withoutArgs() throws org.apache.thrift.TException { + send_withoutArgs(); + return recv_withoutArgs(); + } + + public void send_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_args args = new withoutArgs_args(); + sendBase("withoutArgs", args); + } + + public java.lang.String recv_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + receiveBase(result, "withoutArgs"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withoutArgs failed: unknown result"); + } + + public java.lang.String withError() throws org.apache.thrift.TException { + send_withError(); + return recv_withError(); + } + + public void send_withError() throws org.apache.thrift.TException { + withError_args args = new withError_args(); + sendBase("withError", args); + } + + public java.lang.String recv_withError() throws org.apache.thrift.TException { + withError_result result = new withError_result(); + receiveBase(result, "withError"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withError failed: unknown result"); + } + + public java.lang.String withCollisioin(java.lang.String input) + throws org.apache.thrift.TException { + send_withCollisioin(input); + return recv_withCollisioin(); + } + + public void send_withCollisioin(java.lang.String input) throws org.apache.thrift.TException { + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + sendBase("withCollisioin", args); + } + + public java.lang.String recv_withCollisioin() throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + receiveBase(result, "withCollisioin"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withCollisioin failed: unknown result"); + } + + public void noReturn(int delay) throws org.apache.thrift.TException { + send_noReturn(delay); + recv_noReturn(); + } + + public void send_noReturn(int delay) throws org.apache.thrift.TException { + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + sendBase("noReturn", args); + } + + public void recv_noReturn() throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + receiveBase(result, "noReturn"); + return; + } + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException { + send_oneWayHasArgs(delay); + } + + public void send_oneWayHasArgs(int delay) throws org.apache.thrift.TException { + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + sendBaseOneway("oneWayHasArgs", args); + } + + public void oneWay() throws org.apache.thrift.TException { + send_oneWay(); + } + + public void send_oneWay() throws org.apache.thrift.TException { + oneWay_args args = new oneWay_args(); + sendBaseOneway("oneWay", args); + } + + public void oneWayWithError() throws org.apache.thrift.TException { + send_oneWayWithError(); + } + + public void send_oneWayWithError() throws org.apache.thrift.TException { + oneWayWithError_args args = new oneWayWithError_args(); + sendBaseOneway("oneWayWithError", args); + } + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException { + send_data(user, account); + return recv_data(); + } + + public void send_data(User user, Account account) throws org.apache.thrift.TException { + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + sendBase("data", args); + } + + public UserAccount recv_data() throws org.apache.thrift.TException { + data_result result = new data_result(); + receiveBase(result, "data"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, "data failed: unknown result"); + } + } + + public static class AsyncClient extends org.apache.thrift.async.TAsyncClient + implements AsyncIface { + public static class Factory + implements org.apache.thrift.async.TAsyncClientFactory { + private org.apache.thrift.async.TAsyncClientManager clientManager; + private org.apache.thrift.protocol.TProtocolFactory protocolFactory; + + public Factory( + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.protocol.TProtocolFactory protocolFactory) { + this.clientManager = clientManager; + this.protocolFactory = protocolFactory; + } + + public AsyncClient getAsyncClient( + org.apache.thrift.transport.TNonblockingTransport transport) { + return new AsyncClient(protocolFactory, clientManager, transport); + } + } + + public AsyncClient( + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.transport.TNonblockingTransport transport) { + super(protocolFactory, clientManager, transport); + } + + public void sayHello( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + sayHello_call method_call = + new sayHello_call(zone, name, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class sayHello_call + extends org.apache.thrift.async.TAsyncMethodCall { + private java.lang.String zone; + private java.lang.String name; + + public sayHello_call( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.zone = zone; + this.name = name; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "sayHello", org.apache.thrift.protocol.TMessageType.CALL, 0)); + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_sayHello(); + } + } + + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withDelay_call method_call = + new withDelay_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withDelay_call + extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public withDelay_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withDelay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withDelay(); + } + } + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withoutArgs_call method_call = + new withoutArgs_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withoutArgs_call + extends org.apache.thrift.async.TAsyncMethodCall { + public withoutArgs_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withoutArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withoutArgs_args args = new withoutArgs_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withoutArgs(); + } + } + + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withError_call method_call = + new withError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withError_call + extends org.apache.thrift.async.TAsyncMethodCall { + public withError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withError_args args = new withError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withError(); + } + } + + public void withCollisioin( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withCollisioin_call method_call = + new withCollisioin_call(input, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withCollisioin_call + extends org.apache.thrift.async.TAsyncMethodCall { + private java.lang.String input; + + public withCollisioin_call( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.input = input; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withCollisioin", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withCollisioin(); + } + } + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + noReturn_call method_call = + new noReturn_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class noReturn_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public noReturn_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "noReturn", org.apache.thrift.protocol.TMessageType.CALL, 0)); + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayHasArgs_call method_call = + new oneWayHasArgs_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayHasArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public oneWayHasArgs_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayHasArgs", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWay_call method_call = + new oneWay_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWay_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWay_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWay", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWay_args args = new oneWay_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayWithError_call method_call = + new oneWayWithError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayWithError_call + extends org.apache.thrift.async.TAsyncMethodCall { + public oneWayWithError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayWithError", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayWithError_args args = new oneWayWithError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + data_call method_call = + new data_call(user, account, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class data_call extends org.apache.thrift.async.TAsyncMethodCall { + private User user; + private Account account; + + public data_call( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.user = user; + this.account = account; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "data", org.apache.thrift.protocol.TMessageType.CALL, 0)); + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + args.write(prot); + prot.writeMessageEnd(); + } + + public UserAccount getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_data(); + } + } + } + + public static class Processor extends org.apache.thrift.TBaseProcessor + implements org.apache.thrift.TProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(Processor.class.getName()); + + public Processor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + java.lang.String, + org.apache.thrift.ProcessFunction>())); + } + + protected Processor( + I iface, + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + getProcessMap( + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.ProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public sayHello_result getResult(I iface, sayHello_args args) + throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + result.success = iface.sayHello(args.zone, args.name); + return result; + } + } + + public static class withDelay + extends org.apache.thrift.ProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withDelay_result getResult(I iface, withDelay_args args) + throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + result.success = iface.withDelay(args.delay); + return result; + } + } + + public static class withoutArgs + extends org.apache.thrift.ProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withoutArgs_result getResult(I iface, withoutArgs_args args) + throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + result.success = iface.withoutArgs(); + return result; + } + } + + public static class withError + extends org.apache.thrift.ProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withError_result getResult(I iface, withError_args args) + throws org.apache.thrift.TException { + withError_result result = new withError_result(); + result.success = iface.withError(); + return result; + } + } + + public static class withCollisioin + extends org.apache.thrift.ProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withCollisioin_result getResult(I iface, withCollisioin_args args) + throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + result.success = iface.withCollisioin(args.input); + return result; + } + } + + public static class noReturn + extends org.apache.thrift.ProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public noReturn_result getResult(I iface, noReturn_args args) + throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + iface.noReturn(args.delay); + return result; + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.ProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayHasArgs_args args) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay); + return null; + } + } + + public static class oneWay + extends org.apache.thrift.ProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public org.apache.thrift.TBase getResult(I iface, oneWay_args args) + throws org.apache.thrift.TException { + iface.oneWay(); + return null; + } + } + + public static class oneWayWithError + extends org.apache.thrift.ProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayWithError_args args) + throws org.apache.thrift.TException { + iface.oneWayWithError(); + return null; + } + } + + public static class data + extends org.apache.thrift.ProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public data_result getResult(I iface, data_args args) throws org.apache.thrift.TException { + data_result result = new data_result(); + result.success = iface.data(args.user, args.account); + return result; + } + } + } + + public static class AsyncProcessor + extends org.apache.thrift.TBaseAsyncProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(AsyncProcessor.class.getName()); + + public AsyncProcessor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>>())); + } + + protected AsyncProcessor( + I iface, + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction> + getProcessMap( + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.AsyncProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + sayHello_result result = new sayHello_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + sayHello_result result = new sayHello_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + sayHello_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.sayHello(args.zone, args.name, resultHandler); + } + } + + public static class withDelay + extends org.apache.thrift.AsyncProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withDelay_result result = new withDelay_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withDelay_result result = new withDelay_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withDelay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withDelay(args.delay, resultHandler); + } + } + + public static class withoutArgs + extends org.apache.thrift.AsyncProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withoutArgs_result result = new withoutArgs_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withoutArgs_result result = new withoutArgs_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withoutArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withoutArgs(resultHandler); + } + } + + public static class withError + extends org.apache.thrift.AsyncProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withError_result result = new withError_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withError_result result = new withError_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withError(resultHandler); + } + } + + public static class withCollisioin + extends org.apache.thrift.AsyncProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withCollisioin_result result = new withCollisioin_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withCollisioin_result result = new withCollisioin_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withCollisioin_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withCollisioin(args.input, resultHandler); + } + } + + public static class noReturn + extends org.apache.thrift.AsyncProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) { + noReturn_result result = new noReturn_result(); + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + noReturn_result result = new noReturn_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + noReturn_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.noReturn(args.delay, resultHandler); + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.AsyncProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWayHasArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay, resultHandler); + } + } + + public static class oneWay + extends org.apache.thrift.AsyncProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWay(resultHandler); + } + } + + public static class oneWayWithError + extends org.apache.thrift.AsyncProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWayWithError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayWithError(resultHandler); + } + } + + public static class data + extends org.apache.thrift.AsyncProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(UserAccount o) { + data_result result = new data_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + data_result result = new data_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + data_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.data(args.user, args.account, resultHandler); + } + } + } + + public static class sayHello_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_args"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String zone; // required + public @org.apache.thrift.annotation.Nullable java.lang.String name; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + NAME((short) 2, "name"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // NAME + return NAME; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_args.class, metaDataMap); + } + + public sayHello_args() {} + + public sayHello_args(java.lang.String zone, java.lang.String name) { + this(); + this.zone = zone; + this.name = name; + } + + /** Performs a deep copy on other. */ + public sayHello_args(sayHello_args other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetName()) { + this.name = other.name; + } + } + + public sayHello_args deepCopy() { + return new sayHello_args(this); + } + + @Override + public void clear() { + this.zone = null; + this.name = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getZone() { + return this.zone; + } + + public sayHello_args setZone(@org.apache.thrift.annotation.Nullable java.lang.String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getName() { + return this.name; + } + + public sayHello_args setName(@org.apache.thrift.annotation.Nullable java.lang.String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((java.lang.String) value); + } + break; + + case NAME: + if (value == null) { + unsetName(); + } else { + setName((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case NAME: + return getName(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case NAME: + return isSetName(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof sayHello_args) return this.equals((sayHello_args) that); + return false; + } + + public boolean equals(sayHello_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetZone(), other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetName(), other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("sayHello_args("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_argsStandardScheme getScheme() { + return new sayHello_argsStandardScheme(); + } + } + + private static class sayHello_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_argsTupleScheme getScheme() { + return new sayHello_argsTupleScheme(); + } + } + + private static class sayHello_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetZone()) { + optionals.set(0); + } + if (struct.isSetName()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetZone()) { + oprot.writeString(struct.zone); + } + if (struct.isSetName()) { + oprot.writeString(struct.name); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } + if (incoming.get(1)) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class sayHello_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_result.class, metaDataMap); + } + + public sayHello_result() {} + + public sayHello_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public sayHello_result(sayHello_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public sayHello_result deepCopy() { + return new sayHello_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public sayHello_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof sayHello_result) return this.equals((sayHello_result) that); + return false; + } + + public boolean equals(sayHello_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("sayHello_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_resultStandardScheme getScheme() { + return new sayHello_resultStandardScheme(); + } + } + + private static class sayHello_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_resultTupleScheme getScheme() { + return new sayHello_resultTupleScheme(); + } + } + + private static class sayHello_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withDelay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_args.class, metaDataMap); + } + + public withDelay_args() {} + + public withDelay_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public withDelay_args(withDelay_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public withDelay_args deepCopy() { + return new withDelay_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public withDelay_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withDelay_args) return this.equals((withDelay_args) that); + return false; + } + + public boolean equals(withDelay_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(withDelay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withDelay_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_argsStandardScheme getScheme() { + return new withDelay_argsStandardScheme(); + } + } + + private static class withDelay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_argsTupleScheme getScheme() { + return new withDelay_argsTupleScheme(); + } + } + + private static class withDelay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withDelay_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_result.class, metaDataMap); + } + + public withDelay_result() {} + + public withDelay_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withDelay_result(withDelay_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withDelay_result deepCopy() { + return new withDelay_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withDelay_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withDelay_result) return this.equals((withDelay_result) that); + return false; + } + + public boolean equals(withDelay_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withDelay_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withDelay_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_resultStandardScheme getScheme() { + return new withDelay_resultStandardScheme(); + } + } + + private static class withDelay_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_resultTupleScheme getScheme() { + return new withDelay_resultTupleScheme(); + } + } + + private static class withDelay_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withoutArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_args.class, metaDataMap); + } + + public withoutArgs_args() {} + + /** Performs a deep copy on other. */ + public withoutArgs_args(withoutArgs_args other) {} + + public withoutArgs_args deepCopy() { + return new withoutArgs_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withoutArgs_args) return this.equals((withoutArgs_args) that); + return false; + } + + public boolean equals(withoutArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withoutArgs_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_argsStandardScheme getScheme() { + return new withoutArgs_argsStandardScheme(); + } + } + + private static class withoutArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_argsTupleScheme getScheme() { + return new withoutArgs_argsTupleScheme(); + } + } + + private static class withoutArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withoutArgs_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_result.class, metaDataMap); + } + + public withoutArgs_result() {} + + public withoutArgs_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withoutArgs_result(withoutArgs_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withoutArgs_result deepCopy() { + return new withoutArgs_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withoutArgs_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withoutArgs_result) return this.equals((withoutArgs_result) that); + return false; + } + + public boolean equals(withoutArgs_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withoutArgs_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_resultStandardScheme getScheme() { + return new withoutArgs_resultStandardScheme(); + } + } + + private static class withoutArgs_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_resultTupleScheme getScheme() { + return new withoutArgs_resultTupleScheme(); + } + } + + private static class withoutArgs_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_args.class, metaDataMap); + } + + public withError_args() {} + + /** Performs a deep copy on other. */ + public withError_args(withError_args other) {} + + public withError_args deepCopy() { + return new withError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withError_args) return this.equals((withError_args) that); + return false; + } + + public boolean equals(withError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_argsStandardScheme getScheme() { + return new withError_argsStandardScheme(); + } + } + + private static class withError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_argsTupleScheme getScheme() { + return new withError_argsTupleScheme(); + } + } + + private static class withError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withError_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_result.class, metaDataMap); + } + + public withError_result() {} + + public withError_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withError_result(withError_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withError_result deepCopy() { + return new withError_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withError_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withError_result) return this.equals((withError_result) that); + return false; + } + + public boolean equals(withError_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withError_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withError_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_resultStandardScheme getScheme() { + return new withError_resultStandardScheme(); + } + } + + private static class withError_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_resultTupleScheme getScheme() { + return new withError_resultTupleScheme(); + } + } + + private static class withError_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withCollisioin_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_args"); + + private static final org.apache.thrift.protocol.TField INPUT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "input", org.apache.thrift.protocol.TType.STRING, (short) 3333); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String input; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + INPUT((short) 3333, "input"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 3333: // INPUT + return INPUT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.INPUT, + new org.apache.thrift.meta_data.FieldMetaData( + "input", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_args.class, metaDataMap); + } + + public withCollisioin_args() {} + + public withCollisioin_args(java.lang.String input) { + this(); + this.input = input; + } + + /** Performs a deep copy on other. */ + public withCollisioin_args(withCollisioin_args other) { + if (other.isSetInput()) { + this.input = other.input; + } + } + + public withCollisioin_args deepCopy() { + return new withCollisioin_args(this); + } + + @Override + public void clear() { + this.input = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getInput() { + return this.input; + } + + public withCollisioin_args setInput( + @org.apache.thrift.annotation.Nullable java.lang.String input) { + this.input = input; + return this; + } + + public void unsetInput() { + this.input = null; + } + + /** Returns true if field input is set (has been assigned a value) and false otherwise */ + public boolean isSetInput() { + return this.input != null; + } + + public void setInputIsSet(boolean value) { + if (!value) { + this.input = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case INPUT: + if (value == null) { + unsetInput(); + } else { + setInput((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case INPUT: + return getInput(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case INPUT: + return isSetInput(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withCollisioin_args) return this.equals((withCollisioin_args) that); + return false; + } + + public boolean equals(withCollisioin_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_input = true && this.isSetInput(); + boolean that_present_input = true && that.isSetInput(); + if (this_present_input || that_present_input) { + if (!(this_present_input && that_present_input)) return false; + if (!this.input.equals(that.input)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetInput()) ? 131071 : 524287); + if (isSetInput()) hashCode = hashCode * 8191 + input.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetInput(), other.isSetInput()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInput()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.input, other.input); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withCollisioin_args("); + boolean first = true; + + sb.append("input:"); + if (this.input == null) { + sb.append("null"); + } else { + sb.append(this.input); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_argsStandardScheme getScheme() { + return new withCollisioin_argsStandardScheme(); + } + } + + private static class withCollisioin_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 3333: // INPUT + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.input != null) { + oprot.writeFieldBegin(INPUT_FIELD_DESC); + oprot.writeString(struct.input); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_argsTupleScheme getScheme() { + return new withCollisioin_argsTupleScheme(); + } + } + + private static class withCollisioin_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetInput()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetInput()) { + oprot.writeString(struct.input); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withCollisioin_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_result.class, metaDataMap); + } + + public withCollisioin_result() {} + + public withCollisioin_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withCollisioin_result(withCollisioin_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withCollisioin_result deepCopy() { + return new withCollisioin_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withCollisioin_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withCollisioin_result) return this.equals((withCollisioin_result) that); + return false; + } + + public boolean equals(withCollisioin_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withCollisioin_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_resultStandardScheme getScheme() { + return new withCollisioin_resultStandardScheme(); + } + } + + private static class withCollisioin_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_resultTupleScheme getScheme() { + return new withCollisioin_resultTupleScheme(); + } + } + + private static class withCollisioin_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class noReturn_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_args.class, metaDataMap); + } + + public noReturn_args() {} + + public noReturn_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public noReturn_args(noReturn_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public noReturn_args deepCopy() { + return new noReturn_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public noReturn_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof noReturn_args) return this.equals((noReturn_args) that); + return false; + } + + public boolean equals(noReturn_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(noReturn_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("noReturn_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_argsStandardScheme getScheme() { + return new noReturn_argsStandardScheme(); + } + } + + private static class noReturn_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_argsTupleScheme getScheme() { + return new noReturn_argsTupleScheme(); + } + } + + private static class noReturn_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class noReturn_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_result"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_resultTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_result.class, metaDataMap); + } + + public noReturn_result() {} + + /** Performs a deep copy on other. */ + public noReturn_result(noReturn_result other) {} + + public noReturn_result deepCopy() { + return new noReturn_result(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof noReturn_result) return this.equals((noReturn_result) that); + return false; + } + + public boolean equals(noReturn_result that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(noReturn_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("noReturn_result("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_resultStandardScheme getScheme() { + return new noReturn_resultStandardScheme(); + } + } + + private static class noReturn_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_resultTupleScheme getScheme() { + return new noReturn_resultTupleScheme(); + } + } + + private static class noReturn_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class oneWayHasArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayHasArgs_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayHasArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayHasArgs_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayHasArgs_args.class, metaDataMap); + } + + public oneWayHasArgs_args() {} + + public oneWayHasArgs_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public oneWayHasArgs_args(oneWayHasArgs_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public oneWayHasArgs_args deepCopy() { + return new oneWayHasArgs_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public oneWayHasArgs_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWayHasArgs_args) return this.equals((oneWayHasArgs_args) that); + return false; + } + + public boolean equals(oneWayHasArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(oneWayHasArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWayHasArgs_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayHasArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayHasArgs_argsStandardScheme getScheme() { + return new oneWayHasArgs_argsStandardScheme(); + } + } + + private static class oneWayHasArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayHasArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayHasArgs_argsTupleScheme getScheme() { + return new oneWayHasArgs_argsTupleScheme(); + } + } + + private static class oneWayHasArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class oneWay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWay_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWay_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWay_args.class, metaDataMap); + } + + public oneWay_args() {} + + /** Performs a deep copy on other. */ + public oneWay_args(oneWay_args other) {} + + public oneWay_args deepCopy() { + return new oneWay_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWay_args) return this.equals((oneWay_args) that); + return false; + } + + public boolean equals(oneWay_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWay_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWay_argsStandardScheme getScheme() { + return new oneWay_argsStandardScheme(); + } + } + + private static class oneWay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWay_argsTupleScheme getScheme() { + return new oneWay_argsTupleScheme(); + } + } + + private static class oneWay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class oneWayWithError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayWithError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayWithError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayWithError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayWithError_args.class, metaDataMap); + } + + public oneWayWithError_args() {} + + /** Performs a deep copy on other. */ + public oneWayWithError_args(oneWayWithError_args other) {} + + public oneWayWithError_args deepCopy() { + return new oneWayWithError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWayWithError_args) return this.equals((oneWayWithError_args) that); + return false; + } + + public boolean equals(oneWayWithError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWayWithError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWayWithError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayWithError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayWithError_argsStandardScheme getScheme() { + return new oneWayWithError_argsStandardScheme(); + } + } + + private static class oneWayWithError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayWithError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayWithError_argsTupleScheme getScheme() { + return new oneWayWithError_argsTupleScheme(); + } + } + + private static class oneWayWithError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class data_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_args"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable User user; // required + public @org.apache.thrift.annotation.Nullable Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(data_args.class, metaDataMap); + } + + public data_args() {} + + public data_args(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public data_args(data_args other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public data_args deepCopy() { + return new data_args(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + @org.apache.thrift.annotation.Nullable + public User getUser() { + return this.user; + } + + public data_args setUser(@org.apache.thrift.annotation.Nullable User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + @org.apache.thrift.annotation.Nullable + public Account getAccount() { + return this.account; + } + + public data_args setAccount(@org.apache.thrift.annotation.Nullable Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof data_args) return this.equals((data_args) that); + return false; + } + + public boolean equals(data_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetUser(), other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAccount(), other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("data_args("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_argsStandardScheme getScheme() { + return new data_argsStandardScheme(); + } + } + + private static class data_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_argsTupleScheme getScheme() { + return new data_argsTupleScheme(); + } + } + + private static class data_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetUser()) { + optionals.set(0); + } + if (struct.isSetAccount()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetUser()) { + struct.user.write(oprot); + } + if (struct.isSetAccount()) { + struct.account.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } + if (incoming.get(1)) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class data_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRUCT, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable UserAccount success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, UserAccount.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + data_result.class, metaDataMap); + } + + public data_result() {} + + public data_result(UserAccount success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public data_result(data_result other) { + if (other.isSetSuccess()) { + this.success = new UserAccount(other.success); + } + } + + public data_result deepCopy() { + return new data_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public UserAccount getSuccess() { + return this.success; + } + + public data_result setSuccess(@org.apache.thrift.annotation.Nullable UserAccount success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((UserAccount) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof data_result) return this.equals((data_result) that); + return false; + } + + public boolean equals(data_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("data_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_resultStandardScheme getScheme() { + return new data_resultStandardScheme(); + } + } + + private static class data_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_resultTupleScheme getScheme() { + return new data_resultTupleScheme(); + } + } + + private static class data_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_2/User.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_2/User.java new file mode 100644 index 000000000000..04fc4200eb48 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_2/User.java @@ -0,0 +1,596 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_14_2; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.14.2)", + date = "2025-02-27") +public class User + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("User"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "userId", org.apache.thrift.protocol.TType.STRING, (short) 2); + private static final org.apache.thrift.protocol.TField AGE_FIELD_DESC = + new org.apache.thrift.protocol.TField("age", org.apache.thrift.protocol.TType.I32, (short) 3); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String name; // required + public @org.apache.thrift.annotation.Nullable java.lang.String userId; // required + public int age; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + NAME((short) 1, "name"), + USER_ID((short) 2, "userId"), + AGE((short) 3, "age"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // NAME + return NAME; + case 2: // USER_ID + return USER_ID; + case 3: // AGE + return AGE; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __AGE_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.USER_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "userId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.AGE, + new org.apache.thrift.meta_data.FieldMetaData( + "age", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(User.class, metaDataMap); + } + + public User() {} + + public User(java.lang.String name, java.lang.String userId, int age) { + this(); + this.name = name; + this.userId = userId; + this.age = age; + setAgeIsSet(true); + } + + /** Performs a deep copy on other. */ + public User(User other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetName()) { + this.name = other.name; + } + if (other.isSetUserId()) { + this.userId = other.userId; + } + this.age = other.age; + } + + public User deepCopy() { + return new User(this); + } + + @Override + public void clear() { + this.name = null; + this.userId = null; + setAgeIsSet(false); + this.age = 0; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getName() { + return this.name; + } + + public User setName(@org.apache.thrift.annotation.Nullable java.lang.String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getUserId() { + return this.userId; + } + + public User setUserId(@org.apache.thrift.annotation.Nullable java.lang.String userId) { + this.userId = userId; + return this; + } + + public void unsetUserId() { + this.userId = null; + } + + /** Returns true if field userId is set (has been assigned a value) and false otherwise */ + public boolean isSetUserId() { + return this.userId != null; + } + + public void setUserIdIsSet(boolean value) { + if (!value) { + this.userId = null; + } + } + + public int getAge() { + return this.age; + } + + public User setAge(int age) { + this.age = age; + setAgeIsSet(true); + return this; + } + + public void unsetAge() { + __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __AGE_ISSET_ID); + } + + /** Returns true if field age is set (has been assigned a value) and false otherwise */ + public boolean isSetAge() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __AGE_ISSET_ID); + } + + public void setAgeIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __AGE_ISSET_ID, value); + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case NAME: + if (value == null) { + unsetName(); + } else { + setName((java.lang.String) value); + } + break; + + case USER_ID: + if (value == null) { + unsetUserId(); + } else { + setUserId((java.lang.String) value); + } + break; + + case AGE: + if (value == null) { + unsetAge(); + } else { + setAge((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case NAME: + return getName(); + + case USER_ID: + return getUserId(); + + case AGE: + return getAge(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case NAME: + return isSetName(); + case USER_ID: + return isSetUserId(); + case AGE: + return isSetAge(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof User) return this.equals((User) that); + return false; + } + + public boolean equals(User that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + boolean this_present_userId = true && this.isSetUserId(); + boolean that_present_userId = true && that.isSetUserId(); + if (this_present_userId || that_present_userId) { + if (!(this_present_userId && that_present_userId)) return false; + if (!this.userId.equals(that.userId)) return false; + } + + boolean this_present_age = true; + boolean that_present_age = true; + if (this_present_age || that_present_age) { + if (!(this_present_age && that_present_age)) return false; + if (this.age != that.age) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + hashCode = hashCode * 8191 + ((isSetUserId()) ? 131071 : 524287); + if (isSetUserId()) hashCode = hashCode * 8191 + userId.hashCode(); + + hashCode = hashCode * 8191 + age; + + return hashCode; + } + + @Override + public int compareTo(User other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetName(), other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetUserId(), other.isSetUserId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAge(), other.isSetAge()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAge()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.age, other.age); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("User("); + boolean first = true; + + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + if (!first) sb.append(", "); + sb.append("userId:"); + if (this.userId == null) { + sb.append("null"); + } else { + sb.append(this.userId); + } + first = false; + if (!first) sb.append(", "); + sb.append("age:"); + sb.append(this.age); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (name == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'name' was not present! Struct: " + toString()); + } + if (userId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'userId' was not present! Struct: " + toString()); + } + // alas, we cannot check 'age' because it's a primitive and you chose the non-beans generator. + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public UserStandardScheme getScheme() { + return new UserStandardScheme(); + } + } + + private static class UserStandardScheme extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // AGE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + if (!struct.isSetAge()) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'age' was not found in serialized data! Struct: " + toString()); + } + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, User struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + if (struct.userId != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userId); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(AGE_FIELD_DESC); + oprot.writeI32(struct.age); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public UserTupleScheme getScheme() { + return new UserTupleScheme(); + } + } + + private static class UserTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.name); + oprot.writeString(struct.userId); + oprot.writeI32(struct.age); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.name = iprot.readString(); + struct.setNameIsSet(true); + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_2/UserAccount.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_2/UserAccount.java new file mode 100644 index 000000000000..18035f68ddc5 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_14_2/UserAccount.java @@ -0,0 +1,507 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_14_2; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.14.2)", + date = "2025-02-27") +public class UserAccount + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("UserAccount"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserAccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserAccountTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable User user; // required + public @org.apache.thrift.annotation.Nullable Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserAccount.class, metaDataMap); + } + + public UserAccount() {} + + public UserAccount(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public UserAccount(UserAccount other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public UserAccount deepCopy() { + return new UserAccount(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + @org.apache.thrift.annotation.Nullable + public User getUser() { + return this.user; + } + + public UserAccount setUser(@org.apache.thrift.annotation.Nullable User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + @org.apache.thrift.annotation.Nullable + public Account getAccount() { + return this.account; + } + + public UserAccount setAccount(@org.apache.thrift.annotation.Nullable Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof UserAccount) return this.equals((UserAccount) that); + return false; + } + + public boolean equals(UserAccount that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(UserAccount other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetUser(), other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAccount(), other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("UserAccount("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (user == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'user' was not present! Struct: " + toString()); + } + if (account == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'account' was not present! Struct: " + toString()); + } + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserAccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public UserAccountStandardScheme getScheme() { + return new UserAccountStandardScheme(); + } + } + + private static class UserAccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, UserAccount struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserAccountTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public UserAccountTupleScheme getScheme() { + return new UserAccountTupleScheme(); + } + } + + private static class UserAccountTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user.write(oprot); + struct.account.write(oprot); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_15_0/Account.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_15_0/Account.java new file mode 100644 index 000000000000..f0e03f95038b --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_15_0/Account.java @@ -0,0 +1,495 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_15_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.15.0)", + date = "2025-02-27") +public class Account + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("Account"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField CARD_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "cardId", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new AccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new AccountTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String zone; // required + public @org.apache.thrift.annotation.Nullable java.lang.String cardId; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + CARD_ID((short) 2, "cardId"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // CARD_ID + return CARD_ID; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.CARD_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "cardId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Account.class, metaDataMap); + } + + public Account() {} + + public Account(java.lang.String zone, java.lang.String cardId) { + this(); + this.zone = zone; + this.cardId = cardId; + } + + /** Performs a deep copy on other. */ + public Account(Account other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetCardId()) { + this.cardId = other.cardId; + } + } + + public Account deepCopy() { + return new Account(this); + } + + @Override + public void clear() { + this.zone = null; + this.cardId = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getZone() { + return this.zone; + } + + public Account setZone(@org.apache.thrift.annotation.Nullable java.lang.String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getCardId() { + return this.cardId; + } + + public Account setCardId(@org.apache.thrift.annotation.Nullable java.lang.String cardId) { + this.cardId = cardId; + return this; + } + + public void unsetCardId() { + this.cardId = null; + } + + /** Returns true if field cardId is set (has been assigned a value) and false otherwise */ + public boolean isSetCardId() { + return this.cardId != null; + } + + public void setCardIdIsSet(boolean value) { + if (!value) { + this.cardId = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((java.lang.String) value); + } + break; + + case CARD_ID: + if (value == null) { + unsetCardId(); + } else { + setCardId((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case CARD_ID: + return getCardId(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case CARD_ID: + return isSetCardId(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof Account) return this.equals((Account) that); + return false; + } + + public boolean equals(Account that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_cardId = true && this.isSetCardId(); + boolean that_present_cardId = true && that.isSetCardId(); + if (this_present_cardId || that_present_cardId) { + if (!(this_present_cardId && that_present_cardId)) return false; + if (!this.cardId.equals(that.cardId)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetCardId()) ? 131071 : 524287); + if (isSetCardId()) hashCode = hashCode * 8191 + cardId.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(Account other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetZone(), other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetCardId(), other.isSetCardId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCardId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cardId, other.cardId); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("Account("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("cardId:"); + if (this.cardId == null) { + sb.append("null"); + } else { + sb.append(this.cardId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (zone == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'zone' was not present! Struct: " + toString()); + } + if (cardId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'cardId' was not present! Struct: " + toString()); + } + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class AccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public AccountStandardScheme getScheme() { + return new AccountStandardScheme(); + } + } + + private static class AccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // CARD_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, Account struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.cardId != null) { + oprot.writeFieldBegin(CARD_ID_FIELD_DESC); + oprot.writeString(struct.cardId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class AccountTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public AccountTupleScheme getScheme() { + return new AccountTupleScheme(); + } + } + + private static class AccountTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.zone); + oprot.writeString(struct.cardId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_15_0/ThriftService.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_15_0/ThriftService.java new file mode 100644 index 000000000000..ddabfe68a569 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_15_0/ThriftService.java @@ -0,0 +1,8110 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_15_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.15.0)", + date = "2025-02-27") +public class ThriftService { + + public interface Iface { + + public java.lang.String sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException; + + public java.lang.String withDelay(int delay) throws org.apache.thrift.TException; + + public java.lang.String withoutArgs() throws org.apache.thrift.TException; + + public java.lang.String withError() throws org.apache.thrift.TException; + + public java.lang.String withCollisioin(java.lang.String input) + throws org.apache.thrift.TException; + + public void noReturn(int delay) throws org.apache.thrift.TException; + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException; + + public void oneWay() throws org.apache.thrift.TException; + + public void oneWayWithError() throws org.apache.thrift.TException; + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException; + } + + public interface AsyncIface { + + public void sayHello( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withCollisioin( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + } + + public static class Client extends org.apache.thrift.TServiceClient implements Iface { + public static class Factory implements org.apache.thrift.TServiceClientFactory { + public Factory() {} + + public Client getClient(org.apache.thrift.protocol.TProtocol prot) { + return new Client(prot); + } + + public Client getClient( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + return new Client(iprot, oprot); + } + } + + public Client(org.apache.thrift.protocol.TProtocol prot) { + super(prot, prot); + } + + public Client( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + super(iprot, oprot); + } + + public java.lang.String sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException { + send_sayHello(zone, name); + return recv_sayHello(); + } + + public void send_sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException { + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + sendBase("sayHello", args); + } + + public java.lang.String recv_sayHello() throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + receiveBase(result, "sayHello"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "sayHello failed: unknown result"); + } + + public java.lang.String withDelay(int delay) throws org.apache.thrift.TException { + send_withDelay(delay); + return recv_withDelay(); + } + + public void send_withDelay(int delay) throws org.apache.thrift.TException { + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + sendBase("withDelay", args); + } + + public java.lang.String recv_withDelay() throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + receiveBase(result, "withDelay"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withDelay failed: unknown result"); + } + + public java.lang.String withoutArgs() throws org.apache.thrift.TException { + send_withoutArgs(); + return recv_withoutArgs(); + } + + public void send_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_args args = new withoutArgs_args(); + sendBase("withoutArgs", args); + } + + public java.lang.String recv_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + receiveBase(result, "withoutArgs"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withoutArgs failed: unknown result"); + } + + public java.lang.String withError() throws org.apache.thrift.TException { + send_withError(); + return recv_withError(); + } + + public void send_withError() throws org.apache.thrift.TException { + withError_args args = new withError_args(); + sendBase("withError", args); + } + + public java.lang.String recv_withError() throws org.apache.thrift.TException { + withError_result result = new withError_result(); + receiveBase(result, "withError"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withError failed: unknown result"); + } + + public java.lang.String withCollisioin(java.lang.String input) + throws org.apache.thrift.TException { + send_withCollisioin(input); + return recv_withCollisioin(); + } + + public void send_withCollisioin(java.lang.String input) throws org.apache.thrift.TException { + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + sendBase("withCollisioin", args); + } + + public java.lang.String recv_withCollisioin() throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + receiveBase(result, "withCollisioin"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withCollisioin failed: unknown result"); + } + + public void noReturn(int delay) throws org.apache.thrift.TException { + send_noReturn(delay); + recv_noReturn(); + } + + public void send_noReturn(int delay) throws org.apache.thrift.TException { + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + sendBase("noReturn", args); + } + + public void recv_noReturn() throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + receiveBase(result, "noReturn"); + return; + } + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException { + send_oneWayHasArgs(delay); + } + + public void send_oneWayHasArgs(int delay) throws org.apache.thrift.TException { + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + sendBaseOneway("oneWayHasArgs", args); + } + + public void oneWay() throws org.apache.thrift.TException { + send_oneWay(); + } + + public void send_oneWay() throws org.apache.thrift.TException { + oneWay_args args = new oneWay_args(); + sendBaseOneway("oneWay", args); + } + + public void oneWayWithError() throws org.apache.thrift.TException { + send_oneWayWithError(); + } + + public void send_oneWayWithError() throws org.apache.thrift.TException { + oneWayWithError_args args = new oneWayWithError_args(); + sendBaseOneway("oneWayWithError", args); + } + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException { + send_data(user, account); + return recv_data(); + } + + public void send_data(User user, Account account) throws org.apache.thrift.TException { + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + sendBase("data", args); + } + + public UserAccount recv_data() throws org.apache.thrift.TException { + data_result result = new data_result(); + receiveBase(result, "data"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, "data failed: unknown result"); + } + } + + public static class AsyncClient extends org.apache.thrift.async.TAsyncClient + implements AsyncIface { + public static class Factory + implements org.apache.thrift.async.TAsyncClientFactory { + private org.apache.thrift.async.TAsyncClientManager clientManager; + private org.apache.thrift.protocol.TProtocolFactory protocolFactory; + + public Factory( + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.protocol.TProtocolFactory protocolFactory) { + this.clientManager = clientManager; + this.protocolFactory = protocolFactory; + } + + public AsyncClient getAsyncClient( + org.apache.thrift.transport.TNonblockingTransport transport) { + return new AsyncClient(protocolFactory, clientManager, transport); + } + } + + public AsyncClient( + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.transport.TNonblockingTransport transport) { + super(protocolFactory, clientManager, transport); + } + + public void sayHello( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + sayHello_call method_call = + new sayHello_call(zone, name, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class sayHello_call + extends org.apache.thrift.async.TAsyncMethodCall { + private java.lang.String zone; + private java.lang.String name; + + public sayHello_call( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.zone = zone; + this.name = name; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "sayHello", org.apache.thrift.protocol.TMessageType.CALL, 0)); + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_sayHello(); + } + } + + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withDelay_call method_call = + new withDelay_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withDelay_call + extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public withDelay_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withDelay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withDelay(); + } + } + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withoutArgs_call method_call = + new withoutArgs_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withoutArgs_call + extends org.apache.thrift.async.TAsyncMethodCall { + public withoutArgs_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withoutArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withoutArgs_args args = new withoutArgs_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withoutArgs(); + } + } + + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withError_call method_call = + new withError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withError_call + extends org.apache.thrift.async.TAsyncMethodCall { + public withError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withError_args args = new withError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withError(); + } + } + + public void withCollisioin( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withCollisioin_call method_call = + new withCollisioin_call(input, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withCollisioin_call + extends org.apache.thrift.async.TAsyncMethodCall { + private java.lang.String input; + + public withCollisioin_call( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.input = input; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withCollisioin", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withCollisioin(); + } + } + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + noReturn_call method_call = + new noReturn_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class noReturn_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public noReturn_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "noReturn", org.apache.thrift.protocol.TMessageType.CALL, 0)); + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayHasArgs_call method_call = + new oneWayHasArgs_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayHasArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public oneWayHasArgs_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayHasArgs", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWay_call method_call = + new oneWay_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWay_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWay_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWay", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWay_args args = new oneWay_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayWithError_call method_call = + new oneWayWithError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayWithError_call + extends org.apache.thrift.async.TAsyncMethodCall { + public oneWayWithError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayWithError", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayWithError_args args = new oneWayWithError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + data_call method_call = + new data_call(user, account, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class data_call extends org.apache.thrift.async.TAsyncMethodCall { + private User user; + private Account account; + + public data_call( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.user = user; + this.account = account; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "data", org.apache.thrift.protocol.TMessageType.CALL, 0)); + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + args.write(prot); + prot.writeMessageEnd(); + } + + public UserAccount getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_data(); + } + } + } + + public static class Processor extends org.apache.thrift.TBaseProcessor + implements org.apache.thrift.TProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(Processor.class.getName()); + + public Processor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + java.lang.String, + org.apache.thrift.ProcessFunction>())); + } + + protected Processor( + I iface, + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + getProcessMap( + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.ProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public sayHello_result getResult(I iface, sayHello_args args) + throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + result.success = iface.sayHello(args.zone, args.name); + return result; + } + } + + public static class withDelay + extends org.apache.thrift.ProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withDelay_result getResult(I iface, withDelay_args args) + throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + result.success = iface.withDelay(args.delay); + return result; + } + } + + public static class withoutArgs + extends org.apache.thrift.ProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withoutArgs_result getResult(I iface, withoutArgs_args args) + throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + result.success = iface.withoutArgs(); + return result; + } + } + + public static class withError + extends org.apache.thrift.ProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withError_result getResult(I iface, withError_args args) + throws org.apache.thrift.TException { + withError_result result = new withError_result(); + result.success = iface.withError(); + return result; + } + } + + public static class withCollisioin + extends org.apache.thrift.ProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withCollisioin_result getResult(I iface, withCollisioin_args args) + throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + result.success = iface.withCollisioin(args.input); + return result; + } + } + + public static class noReturn + extends org.apache.thrift.ProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public noReturn_result getResult(I iface, noReturn_args args) + throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + iface.noReturn(args.delay); + return result; + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.ProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayHasArgs_args args) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay); + return null; + } + } + + public static class oneWay + extends org.apache.thrift.ProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public org.apache.thrift.TBase getResult(I iface, oneWay_args args) + throws org.apache.thrift.TException { + iface.oneWay(); + return null; + } + } + + public static class oneWayWithError + extends org.apache.thrift.ProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayWithError_args args) + throws org.apache.thrift.TException { + iface.oneWayWithError(); + return null; + } + } + + public static class data + extends org.apache.thrift.ProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public data_result getResult(I iface, data_args args) throws org.apache.thrift.TException { + data_result result = new data_result(); + result.success = iface.data(args.user, args.account); + return result; + } + } + } + + public static class AsyncProcessor + extends org.apache.thrift.TBaseAsyncProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(AsyncProcessor.class.getName()); + + public AsyncProcessor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>>())); + } + + protected AsyncProcessor( + I iface, + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction> + getProcessMap( + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.AsyncProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + sayHello_result result = new sayHello_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + sayHello_result result = new sayHello_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + sayHello_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.sayHello(args.zone, args.name, resultHandler); + } + } + + public static class withDelay + extends org.apache.thrift.AsyncProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withDelay_result result = new withDelay_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withDelay_result result = new withDelay_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withDelay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withDelay(args.delay, resultHandler); + } + } + + public static class withoutArgs + extends org.apache.thrift.AsyncProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withoutArgs_result result = new withoutArgs_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withoutArgs_result result = new withoutArgs_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withoutArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withoutArgs(resultHandler); + } + } + + public static class withError + extends org.apache.thrift.AsyncProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withError_result result = new withError_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withError_result result = new withError_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withError(resultHandler); + } + } + + public static class withCollisioin + extends org.apache.thrift.AsyncProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withCollisioin_result result = new withCollisioin_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withCollisioin_result result = new withCollisioin_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withCollisioin_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withCollisioin(args.input, resultHandler); + } + } + + public static class noReturn + extends org.apache.thrift.AsyncProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) { + noReturn_result result = new noReturn_result(); + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + noReturn_result result = new noReturn_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + noReturn_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.noReturn(args.delay, resultHandler); + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.AsyncProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWayHasArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay, resultHandler); + } + } + + public static class oneWay + extends org.apache.thrift.AsyncProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWay(resultHandler); + } + } + + public static class oneWayWithError + extends org.apache.thrift.AsyncProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWayWithError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayWithError(resultHandler); + } + } + + public static class data + extends org.apache.thrift.AsyncProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(UserAccount o) { + data_result result = new data_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + data_result result = new data_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + data_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.data(args.user, args.account, resultHandler); + } + } + } + + public static class sayHello_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_args"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String zone; // required + public @org.apache.thrift.annotation.Nullable java.lang.String name; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + NAME((short) 2, "name"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // NAME + return NAME; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_args.class, metaDataMap); + } + + public sayHello_args() {} + + public sayHello_args(java.lang.String zone, java.lang.String name) { + this(); + this.zone = zone; + this.name = name; + } + + /** Performs a deep copy on other. */ + public sayHello_args(sayHello_args other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetName()) { + this.name = other.name; + } + } + + public sayHello_args deepCopy() { + return new sayHello_args(this); + } + + @Override + public void clear() { + this.zone = null; + this.name = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getZone() { + return this.zone; + } + + public sayHello_args setZone(@org.apache.thrift.annotation.Nullable java.lang.String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getName() { + return this.name; + } + + public sayHello_args setName(@org.apache.thrift.annotation.Nullable java.lang.String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((java.lang.String) value); + } + break; + + case NAME: + if (value == null) { + unsetName(); + } else { + setName((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case NAME: + return getName(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case NAME: + return isSetName(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof sayHello_args) return this.equals((sayHello_args) that); + return false; + } + + public boolean equals(sayHello_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetZone(), other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetName(), other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("sayHello_args("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_argsStandardScheme getScheme() { + return new sayHello_argsStandardScheme(); + } + } + + private static class sayHello_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_argsTupleScheme getScheme() { + return new sayHello_argsTupleScheme(); + } + } + + private static class sayHello_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetZone()) { + optionals.set(0); + } + if (struct.isSetName()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetZone()) { + oprot.writeString(struct.zone); + } + if (struct.isSetName()) { + oprot.writeString(struct.name); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } + if (incoming.get(1)) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class sayHello_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_result.class, metaDataMap); + } + + public sayHello_result() {} + + public sayHello_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public sayHello_result(sayHello_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public sayHello_result deepCopy() { + return new sayHello_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public sayHello_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof sayHello_result) return this.equals((sayHello_result) that); + return false; + } + + public boolean equals(sayHello_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("sayHello_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_resultStandardScheme getScheme() { + return new sayHello_resultStandardScheme(); + } + } + + private static class sayHello_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_resultTupleScheme getScheme() { + return new sayHello_resultTupleScheme(); + } + } + + private static class sayHello_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withDelay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_args.class, metaDataMap); + } + + public withDelay_args() {} + + public withDelay_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public withDelay_args(withDelay_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public withDelay_args deepCopy() { + return new withDelay_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public withDelay_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withDelay_args) return this.equals((withDelay_args) that); + return false; + } + + public boolean equals(withDelay_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(withDelay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withDelay_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_argsStandardScheme getScheme() { + return new withDelay_argsStandardScheme(); + } + } + + private static class withDelay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_argsTupleScheme getScheme() { + return new withDelay_argsTupleScheme(); + } + } + + private static class withDelay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withDelay_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_result.class, metaDataMap); + } + + public withDelay_result() {} + + public withDelay_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withDelay_result(withDelay_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withDelay_result deepCopy() { + return new withDelay_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withDelay_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withDelay_result) return this.equals((withDelay_result) that); + return false; + } + + public boolean equals(withDelay_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withDelay_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withDelay_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_resultStandardScheme getScheme() { + return new withDelay_resultStandardScheme(); + } + } + + private static class withDelay_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_resultTupleScheme getScheme() { + return new withDelay_resultTupleScheme(); + } + } + + private static class withDelay_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withoutArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_args.class, metaDataMap); + } + + public withoutArgs_args() {} + + /** Performs a deep copy on other. */ + public withoutArgs_args(withoutArgs_args other) {} + + public withoutArgs_args deepCopy() { + return new withoutArgs_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withoutArgs_args) return this.equals((withoutArgs_args) that); + return false; + } + + public boolean equals(withoutArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withoutArgs_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_argsStandardScheme getScheme() { + return new withoutArgs_argsStandardScheme(); + } + } + + private static class withoutArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_argsTupleScheme getScheme() { + return new withoutArgs_argsTupleScheme(); + } + } + + private static class withoutArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withoutArgs_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_result.class, metaDataMap); + } + + public withoutArgs_result() {} + + public withoutArgs_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withoutArgs_result(withoutArgs_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withoutArgs_result deepCopy() { + return new withoutArgs_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withoutArgs_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withoutArgs_result) return this.equals((withoutArgs_result) that); + return false; + } + + public boolean equals(withoutArgs_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withoutArgs_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_resultStandardScheme getScheme() { + return new withoutArgs_resultStandardScheme(); + } + } + + private static class withoutArgs_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_resultTupleScheme getScheme() { + return new withoutArgs_resultTupleScheme(); + } + } + + private static class withoutArgs_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_args.class, metaDataMap); + } + + public withError_args() {} + + /** Performs a deep copy on other. */ + public withError_args(withError_args other) {} + + public withError_args deepCopy() { + return new withError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withError_args) return this.equals((withError_args) that); + return false; + } + + public boolean equals(withError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_argsStandardScheme getScheme() { + return new withError_argsStandardScheme(); + } + } + + private static class withError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_argsTupleScheme getScheme() { + return new withError_argsTupleScheme(); + } + } + + private static class withError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withError_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_result.class, metaDataMap); + } + + public withError_result() {} + + public withError_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withError_result(withError_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withError_result deepCopy() { + return new withError_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withError_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withError_result) return this.equals((withError_result) that); + return false; + } + + public boolean equals(withError_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withError_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withError_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_resultStandardScheme getScheme() { + return new withError_resultStandardScheme(); + } + } + + private static class withError_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_resultTupleScheme getScheme() { + return new withError_resultTupleScheme(); + } + } + + private static class withError_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withCollisioin_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_args"); + + private static final org.apache.thrift.protocol.TField INPUT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "input", org.apache.thrift.protocol.TType.STRING, (short) 3333); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String input; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + INPUT((short) 3333, "input"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 3333: // INPUT + return INPUT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.INPUT, + new org.apache.thrift.meta_data.FieldMetaData( + "input", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_args.class, metaDataMap); + } + + public withCollisioin_args() {} + + public withCollisioin_args(java.lang.String input) { + this(); + this.input = input; + } + + /** Performs a deep copy on other. */ + public withCollisioin_args(withCollisioin_args other) { + if (other.isSetInput()) { + this.input = other.input; + } + } + + public withCollisioin_args deepCopy() { + return new withCollisioin_args(this); + } + + @Override + public void clear() { + this.input = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getInput() { + return this.input; + } + + public withCollisioin_args setInput( + @org.apache.thrift.annotation.Nullable java.lang.String input) { + this.input = input; + return this; + } + + public void unsetInput() { + this.input = null; + } + + /** Returns true if field input is set (has been assigned a value) and false otherwise */ + public boolean isSetInput() { + return this.input != null; + } + + public void setInputIsSet(boolean value) { + if (!value) { + this.input = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case INPUT: + if (value == null) { + unsetInput(); + } else { + setInput((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case INPUT: + return getInput(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case INPUT: + return isSetInput(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withCollisioin_args) return this.equals((withCollisioin_args) that); + return false; + } + + public boolean equals(withCollisioin_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_input = true && this.isSetInput(); + boolean that_present_input = true && that.isSetInput(); + if (this_present_input || that_present_input) { + if (!(this_present_input && that_present_input)) return false; + if (!this.input.equals(that.input)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetInput()) ? 131071 : 524287); + if (isSetInput()) hashCode = hashCode * 8191 + input.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetInput(), other.isSetInput()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInput()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.input, other.input); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withCollisioin_args("); + boolean first = true; + + sb.append("input:"); + if (this.input == null) { + sb.append("null"); + } else { + sb.append(this.input); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_argsStandardScheme getScheme() { + return new withCollisioin_argsStandardScheme(); + } + } + + private static class withCollisioin_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 3333: // INPUT + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.input != null) { + oprot.writeFieldBegin(INPUT_FIELD_DESC); + oprot.writeString(struct.input); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_argsTupleScheme getScheme() { + return new withCollisioin_argsTupleScheme(); + } + } + + private static class withCollisioin_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetInput()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetInput()) { + oprot.writeString(struct.input); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withCollisioin_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_result.class, metaDataMap); + } + + public withCollisioin_result() {} + + public withCollisioin_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withCollisioin_result(withCollisioin_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withCollisioin_result deepCopy() { + return new withCollisioin_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withCollisioin_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withCollisioin_result) return this.equals((withCollisioin_result) that); + return false; + } + + public boolean equals(withCollisioin_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withCollisioin_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_resultStandardScheme getScheme() { + return new withCollisioin_resultStandardScheme(); + } + } + + private static class withCollisioin_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_resultTupleScheme getScheme() { + return new withCollisioin_resultTupleScheme(); + } + } + + private static class withCollisioin_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class noReturn_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_args.class, metaDataMap); + } + + public noReturn_args() {} + + public noReturn_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public noReturn_args(noReturn_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public noReturn_args deepCopy() { + return new noReturn_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public noReturn_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof noReturn_args) return this.equals((noReturn_args) that); + return false; + } + + public boolean equals(noReturn_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(noReturn_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("noReturn_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_argsStandardScheme getScheme() { + return new noReturn_argsStandardScheme(); + } + } + + private static class noReturn_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_argsTupleScheme getScheme() { + return new noReturn_argsTupleScheme(); + } + } + + private static class noReturn_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class noReturn_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_result"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_resultTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_result.class, metaDataMap); + } + + public noReturn_result() {} + + /** Performs a deep copy on other. */ + public noReturn_result(noReturn_result other) {} + + public noReturn_result deepCopy() { + return new noReturn_result(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof noReturn_result) return this.equals((noReturn_result) that); + return false; + } + + public boolean equals(noReturn_result that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(noReturn_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("noReturn_result("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_resultStandardScheme getScheme() { + return new noReturn_resultStandardScheme(); + } + } + + private static class noReturn_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_resultTupleScheme getScheme() { + return new noReturn_resultTupleScheme(); + } + } + + private static class noReturn_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class oneWayHasArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayHasArgs_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayHasArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayHasArgs_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayHasArgs_args.class, metaDataMap); + } + + public oneWayHasArgs_args() {} + + public oneWayHasArgs_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public oneWayHasArgs_args(oneWayHasArgs_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public oneWayHasArgs_args deepCopy() { + return new oneWayHasArgs_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public oneWayHasArgs_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWayHasArgs_args) return this.equals((oneWayHasArgs_args) that); + return false; + } + + public boolean equals(oneWayHasArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(oneWayHasArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWayHasArgs_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayHasArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayHasArgs_argsStandardScheme getScheme() { + return new oneWayHasArgs_argsStandardScheme(); + } + } + + private static class oneWayHasArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayHasArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayHasArgs_argsTupleScheme getScheme() { + return new oneWayHasArgs_argsTupleScheme(); + } + } + + private static class oneWayHasArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class oneWay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWay_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWay_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWay_args.class, metaDataMap); + } + + public oneWay_args() {} + + /** Performs a deep copy on other. */ + public oneWay_args(oneWay_args other) {} + + public oneWay_args deepCopy() { + return new oneWay_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWay_args) return this.equals((oneWay_args) that); + return false; + } + + public boolean equals(oneWay_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWay_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWay_argsStandardScheme getScheme() { + return new oneWay_argsStandardScheme(); + } + } + + private static class oneWay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWay_argsTupleScheme getScheme() { + return new oneWay_argsTupleScheme(); + } + } + + private static class oneWay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class oneWayWithError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayWithError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayWithError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayWithError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayWithError_args.class, metaDataMap); + } + + public oneWayWithError_args() {} + + /** Performs a deep copy on other. */ + public oneWayWithError_args(oneWayWithError_args other) {} + + public oneWayWithError_args deepCopy() { + return new oneWayWithError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWayWithError_args) return this.equals((oneWayWithError_args) that); + return false; + } + + public boolean equals(oneWayWithError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWayWithError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWayWithError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayWithError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayWithError_argsStandardScheme getScheme() { + return new oneWayWithError_argsStandardScheme(); + } + } + + private static class oneWayWithError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayWithError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayWithError_argsTupleScheme getScheme() { + return new oneWayWithError_argsTupleScheme(); + } + } + + private static class oneWayWithError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class data_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_args"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable User user; // required + public @org.apache.thrift.annotation.Nullable Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(data_args.class, metaDataMap); + } + + public data_args() {} + + public data_args(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public data_args(data_args other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public data_args deepCopy() { + return new data_args(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + @org.apache.thrift.annotation.Nullable + public User getUser() { + return this.user; + } + + public data_args setUser(@org.apache.thrift.annotation.Nullable User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + @org.apache.thrift.annotation.Nullable + public Account getAccount() { + return this.account; + } + + public data_args setAccount(@org.apache.thrift.annotation.Nullable Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof data_args) return this.equals((data_args) that); + return false; + } + + public boolean equals(data_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetUser(), other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAccount(), other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("data_args("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_argsStandardScheme getScheme() { + return new data_argsStandardScheme(); + } + } + + private static class data_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_argsTupleScheme getScheme() { + return new data_argsTupleScheme(); + } + } + + private static class data_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetUser()) { + optionals.set(0); + } + if (struct.isSetAccount()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetUser()) { + struct.user.write(oprot); + } + if (struct.isSetAccount()) { + struct.account.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } + if (incoming.get(1)) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class data_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRUCT, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable UserAccount success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, UserAccount.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + data_result.class, metaDataMap); + } + + public data_result() {} + + public data_result(UserAccount success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public data_result(data_result other) { + if (other.isSetSuccess()) { + this.success = new UserAccount(other.success); + } + } + + public data_result deepCopy() { + return new data_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public UserAccount getSuccess() { + return this.success; + } + + public data_result setSuccess(@org.apache.thrift.annotation.Nullable UserAccount success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((UserAccount) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof data_result) return this.equals((data_result) that); + return false; + } + + public boolean equals(data_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("data_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_resultStandardScheme getScheme() { + return new data_resultStandardScheme(); + } + } + + private static class data_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_resultTupleScheme getScheme() { + return new data_resultTupleScheme(); + } + } + + private static class data_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_15_0/User.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_15_0/User.java new file mode 100644 index 000000000000..e78f1bc2e9c0 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_15_0/User.java @@ -0,0 +1,596 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_15_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.15.0)", + date = "2025-02-27") +public class User + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("User"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "userId", org.apache.thrift.protocol.TType.STRING, (short) 2); + private static final org.apache.thrift.protocol.TField AGE_FIELD_DESC = + new org.apache.thrift.protocol.TField("age", org.apache.thrift.protocol.TType.I32, (short) 3); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String name; // required + public @org.apache.thrift.annotation.Nullable java.lang.String userId; // required + public int age; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + NAME((short) 1, "name"), + USER_ID((short) 2, "userId"), + AGE((short) 3, "age"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // NAME + return NAME; + case 2: // USER_ID + return USER_ID; + case 3: // AGE + return AGE; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __AGE_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.USER_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "userId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.AGE, + new org.apache.thrift.meta_data.FieldMetaData( + "age", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(User.class, metaDataMap); + } + + public User() {} + + public User(java.lang.String name, java.lang.String userId, int age) { + this(); + this.name = name; + this.userId = userId; + this.age = age; + setAgeIsSet(true); + } + + /** Performs a deep copy on other. */ + public User(User other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetName()) { + this.name = other.name; + } + if (other.isSetUserId()) { + this.userId = other.userId; + } + this.age = other.age; + } + + public User deepCopy() { + return new User(this); + } + + @Override + public void clear() { + this.name = null; + this.userId = null; + setAgeIsSet(false); + this.age = 0; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getName() { + return this.name; + } + + public User setName(@org.apache.thrift.annotation.Nullable java.lang.String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getUserId() { + return this.userId; + } + + public User setUserId(@org.apache.thrift.annotation.Nullable java.lang.String userId) { + this.userId = userId; + return this; + } + + public void unsetUserId() { + this.userId = null; + } + + /** Returns true if field userId is set (has been assigned a value) and false otherwise */ + public boolean isSetUserId() { + return this.userId != null; + } + + public void setUserIdIsSet(boolean value) { + if (!value) { + this.userId = null; + } + } + + public int getAge() { + return this.age; + } + + public User setAge(int age) { + this.age = age; + setAgeIsSet(true); + return this; + } + + public void unsetAge() { + __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __AGE_ISSET_ID); + } + + /** Returns true if field age is set (has been assigned a value) and false otherwise */ + public boolean isSetAge() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __AGE_ISSET_ID); + } + + public void setAgeIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __AGE_ISSET_ID, value); + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case NAME: + if (value == null) { + unsetName(); + } else { + setName((java.lang.String) value); + } + break; + + case USER_ID: + if (value == null) { + unsetUserId(); + } else { + setUserId((java.lang.String) value); + } + break; + + case AGE: + if (value == null) { + unsetAge(); + } else { + setAge((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case NAME: + return getName(); + + case USER_ID: + return getUserId(); + + case AGE: + return getAge(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case NAME: + return isSetName(); + case USER_ID: + return isSetUserId(); + case AGE: + return isSetAge(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof User) return this.equals((User) that); + return false; + } + + public boolean equals(User that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + boolean this_present_userId = true && this.isSetUserId(); + boolean that_present_userId = true && that.isSetUserId(); + if (this_present_userId || that_present_userId) { + if (!(this_present_userId && that_present_userId)) return false; + if (!this.userId.equals(that.userId)) return false; + } + + boolean this_present_age = true; + boolean that_present_age = true; + if (this_present_age || that_present_age) { + if (!(this_present_age && that_present_age)) return false; + if (this.age != that.age) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + hashCode = hashCode * 8191 + ((isSetUserId()) ? 131071 : 524287); + if (isSetUserId()) hashCode = hashCode * 8191 + userId.hashCode(); + + hashCode = hashCode * 8191 + age; + + return hashCode; + } + + @Override + public int compareTo(User other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetName(), other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetUserId(), other.isSetUserId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAge(), other.isSetAge()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAge()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.age, other.age); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("User("); + boolean first = true; + + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + if (!first) sb.append(", "); + sb.append("userId:"); + if (this.userId == null) { + sb.append("null"); + } else { + sb.append(this.userId); + } + first = false; + if (!first) sb.append(", "); + sb.append("age:"); + sb.append(this.age); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (name == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'name' was not present! Struct: " + toString()); + } + if (userId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'userId' was not present! Struct: " + toString()); + } + // alas, we cannot check 'age' because it's a primitive and you chose the non-beans generator. + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public UserStandardScheme getScheme() { + return new UserStandardScheme(); + } + } + + private static class UserStandardScheme extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // AGE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + if (!struct.isSetAge()) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'age' was not found in serialized data! Struct: " + toString()); + } + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, User struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + if (struct.userId != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userId); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(AGE_FIELD_DESC); + oprot.writeI32(struct.age); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public UserTupleScheme getScheme() { + return new UserTupleScheme(); + } + } + + private static class UserTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.name); + oprot.writeString(struct.userId); + oprot.writeI32(struct.age); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.name = iprot.readString(); + struct.setNameIsSet(true); + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_15_0/UserAccount.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_15_0/UserAccount.java new file mode 100644 index 000000000000..010354ed480b --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_15_0/UserAccount.java @@ -0,0 +1,507 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_15_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.15.0)", + date = "2025-02-27") +public class UserAccount + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("UserAccount"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserAccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserAccountTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable User user; // required + public @org.apache.thrift.annotation.Nullable Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserAccount.class, metaDataMap); + } + + public UserAccount() {} + + public UserAccount(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public UserAccount(UserAccount other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public UserAccount deepCopy() { + return new UserAccount(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + @org.apache.thrift.annotation.Nullable + public User getUser() { + return this.user; + } + + public UserAccount setUser(@org.apache.thrift.annotation.Nullable User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + @org.apache.thrift.annotation.Nullable + public Account getAccount() { + return this.account; + } + + public UserAccount setAccount(@org.apache.thrift.annotation.Nullable Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof UserAccount) return this.equals((UserAccount) that); + return false; + } + + public boolean equals(UserAccount that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(UserAccount other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetUser(), other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAccount(), other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("UserAccount("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (user == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'user' was not present! Struct: " + toString()); + } + if (account == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'account' was not present! Struct: " + toString()); + } + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserAccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public UserAccountStandardScheme getScheme() { + return new UserAccountStandardScheme(); + } + } + + private static class UserAccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, UserAccount struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserAccountTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public UserAccountTupleScheme getScheme() { + return new UserAccountTupleScheme(); + } + } + + private static class UserAccountTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user.write(oprot); + struct.account.write(oprot); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_16_0/Account.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_16_0/Account.java new file mode 100644 index 000000000000..afb78095b3be --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_16_0/Account.java @@ -0,0 +1,495 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_16_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.16.0)", + date = "2025-02-27") +public class Account + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("Account"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField CARD_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "cardId", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new AccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new AccountTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String zone; // required + public @org.apache.thrift.annotation.Nullable java.lang.String cardId; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + CARD_ID((short) 2, "cardId"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // CARD_ID + return CARD_ID; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.CARD_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "cardId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Account.class, metaDataMap); + } + + public Account() {} + + public Account(java.lang.String zone, java.lang.String cardId) { + this(); + this.zone = zone; + this.cardId = cardId; + } + + /** Performs a deep copy on other. */ + public Account(Account other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetCardId()) { + this.cardId = other.cardId; + } + } + + public Account deepCopy() { + return new Account(this); + } + + @Override + public void clear() { + this.zone = null; + this.cardId = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getZone() { + return this.zone; + } + + public Account setZone(@org.apache.thrift.annotation.Nullable java.lang.String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getCardId() { + return this.cardId; + } + + public Account setCardId(@org.apache.thrift.annotation.Nullable java.lang.String cardId) { + this.cardId = cardId; + return this; + } + + public void unsetCardId() { + this.cardId = null; + } + + /** Returns true if field cardId is set (has been assigned a value) and false otherwise */ + public boolean isSetCardId() { + return this.cardId != null; + } + + public void setCardIdIsSet(boolean value) { + if (!value) { + this.cardId = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((java.lang.String) value); + } + break; + + case CARD_ID: + if (value == null) { + unsetCardId(); + } else { + setCardId((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case CARD_ID: + return getCardId(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case CARD_ID: + return isSetCardId(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof Account) return this.equals((Account) that); + return false; + } + + public boolean equals(Account that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_cardId = true && this.isSetCardId(); + boolean that_present_cardId = true && that.isSetCardId(); + if (this_present_cardId || that_present_cardId) { + if (!(this_present_cardId && that_present_cardId)) return false; + if (!this.cardId.equals(that.cardId)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetCardId()) ? 131071 : 524287); + if (isSetCardId()) hashCode = hashCode * 8191 + cardId.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(Account other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetZone(), other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetCardId(), other.isSetCardId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCardId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cardId, other.cardId); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("Account("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("cardId:"); + if (this.cardId == null) { + sb.append("null"); + } else { + sb.append(this.cardId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (zone == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'zone' was not present! Struct: " + toString()); + } + if (cardId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'cardId' was not present! Struct: " + toString()); + } + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class AccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public AccountStandardScheme getScheme() { + return new AccountStandardScheme(); + } + } + + private static class AccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // CARD_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, Account struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.cardId != null) { + oprot.writeFieldBegin(CARD_ID_FIELD_DESC); + oprot.writeString(struct.cardId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class AccountTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public AccountTupleScheme getScheme() { + return new AccountTupleScheme(); + } + } + + private static class AccountTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.zone); + oprot.writeString(struct.cardId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_16_0/ThriftService.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_16_0/ThriftService.java new file mode 100644 index 000000000000..08a10e243353 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_16_0/ThriftService.java @@ -0,0 +1,8110 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_16_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.16.0)", + date = "2025-02-27") +public class ThriftService { + + public interface Iface { + + public java.lang.String sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException; + + public java.lang.String withDelay(int delay) throws org.apache.thrift.TException; + + public java.lang.String withoutArgs() throws org.apache.thrift.TException; + + public java.lang.String withError() throws org.apache.thrift.TException; + + public java.lang.String withCollisioin(java.lang.String input) + throws org.apache.thrift.TException; + + public void noReturn(int delay) throws org.apache.thrift.TException; + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException; + + public void oneWay() throws org.apache.thrift.TException; + + public void oneWayWithError() throws org.apache.thrift.TException; + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException; + } + + public interface AsyncIface { + + public void sayHello( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withCollisioin( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + } + + public static class Client extends org.apache.thrift.TServiceClient implements Iface { + public static class Factory implements org.apache.thrift.TServiceClientFactory { + public Factory() {} + + public Client getClient(org.apache.thrift.protocol.TProtocol prot) { + return new Client(prot); + } + + public Client getClient( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + return new Client(iprot, oprot); + } + } + + public Client(org.apache.thrift.protocol.TProtocol prot) { + super(prot, prot); + } + + public Client( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + super(iprot, oprot); + } + + public java.lang.String sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException { + send_sayHello(zone, name); + return recv_sayHello(); + } + + public void send_sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException { + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + sendBase("sayHello", args); + } + + public java.lang.String recv_sayHello() throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + receiveBase(result, "sayHello"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "sayHello failed: unknown result"); + } + + public java.lang.String withDelay(int delay) throws org.apache.thrift.TException { + send_withDelay(delay); + return recv_withDelay(); + } + + public void send_withDelay(int delay) throws org.apache.thrift.TException { + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + sendBase("withDelay", args); + } + + public java.lang.String recv_withDelay() throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + receiveBase(result, "withDelay"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withDelay failed: unknown result"); + } + + public java.lang.String withoutArgs() throws org.apache.thrift.TException { + send_withoutArgs(); + return recv_withoutArgs(); + } + + public void send_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_args args = new withoutArgs_args(); + sendBase("withoutArgs", args); + } + + public java.lang.String recv_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + receiveBase(result, "withoutArgs"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withoutArgs failed: unknown result"); + } + + public java.lang.String withError() throws org.apache.thrift.TException { + send_withError(); + return recv_withError(); + } + + public void send_withError() throws org.apache.thrift.TException { + withError_args args = new withError_args(); + sendBase("withError", args); + } + + public java.lang.String recv_withError() throws org.apache.thrift.TException { + withError_result result = new withError_result(); + receiveBase(result, "withError"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withError failed: unknown result"); + } + + public java.lang.String withCollisioin(java.lang.String input) + throws org.apache.thrift.TException { + send_withCollisioin(input); + return recv_withCollisioin(); + } + + public void send_withCollisioin(java.lang.String input) throws org.apache.thrift.TException { + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + sendBase("withCollisioin", args); + } + + public java.lang.String recv_withCollisioin() throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + receiveBase(result, "withCollisioin"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withCollisioin failed: unknown result"); + } + + public void noReturn(int delay) throws org.apache.thrift.TException { + send_noReturn(delay); + recv_noReturn(); + } + + public void send_noReturn(int delay) throws org.apache.thrift.TException { + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + sendBase("noReturn", args); + } + + public void recv_noReturn() throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + receiveBase(result, "noReturn"); + return; + } + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException { + send_oneWayHasArgs(delay); + } + + public void send_oneWayHasArgs(int delay) throws org.apache.thrift.TException { + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + sendBaseOneway("oneWayHasArgs", args); + } + + public void oneWay() throws org.apache.thrift.TException { + send_oneWay(); + } + + public void send_oneWay() throws org.apache.thrift.TException { + oneWay_args args = new oneWay_args(); + sendBaseOneway("oneWay", args); + } + + public void oneWayWithError() throws org.apache.thrift.TException { + send_oneWayWithError(); + } + + public void send_oneWayWithError() throws org.apache.thrift.TException { + oneWayWithError_args args = new oneWayWithError_args(); + sendBaseOneway("oneWayWithError", args); + } + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException { + send_data(user, account); + return recv_data(); + } + + public void send_data(User user, Account account) throws org.apache.thrift.TException { + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + sendBase("data", args); + } + + public UserAccount recv_data() throws org.apache.thrift.TException { + data_result result = new data_result(); + receiveBase(result, "data"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, "data failed: unknown result"); + } + } + + public static class AsyncClient extends org.apache.thrift.async.TAsyncClient + implements AsyncIface { + public static class Factory + implements org.apache.thrift.async.TAsyncClientFactory { + private org.apache.thrift.async.TAsyncClientManager clientManager; + private org.apache.thrift.protocol.TProtocolFactory protocolFactory; + + public Factory( + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.protocol.TProtocolFactory protocolFactory) { + this.clientManager = clientManager; + this.protocolFactory = protocolFactory; + } + + public AsyncClient getAsyncClient( + org.apache.thrift.transport.TNonblockingTransport transport) { + return new AsyncClient(protocolFactory, clientManager, transport); + } + } + + public AsyncClient( + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.transport.TNonblockingTransport transport) { + super(protocolFactory, clientManager, transport); + } + + public void sayHello( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + sayHello_call method_call = + new sayHello_call(zone, name, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class sayHello_call + extends org.apache.thrift.async.TAsyncMethodCall { + private java.lang.String zone; + private java.lang.String name; + + public sayHello_call( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.zone = zone; + this.name = name; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "sayHello", org.apache.thrift.protocol.TMessageType.CALL, 0)); + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_sayHello(); + } + } + + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withDelay_call method_call = + new withDelay_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withDelay_call + extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public withDelay_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withDelay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withDelay(); + } + } + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withoutArgs_call method_call = + new withoutArgs_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withoutArgs_call + extends org.apache.thrift.async.TAsyncMethodCall { + public withoutArgs_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withoutArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withoutArgs_args args = new withoutArgs_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withoutArgs(); + } + } + + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withError_call method_call = + new withError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withError_call + extends org.apache.thrift.async.TAsyncMethodCall { + public withError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withError_args args = new withError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withError(); + } + } + + public void withCollisioin( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withCollisioin_call method_call = + new withCollisioin_call(input, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withCollisioin_call + extends org.apache.thrift.async.TAsyncMethodCall { + private java.lang.String input; + + public withCollisioin_call( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.input = input; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withCollisioin", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + args.write(prot); + prot.writeMessageEnd(); + } + + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withCollisioin(); + } + } + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + noReturn_call method_call = + new noReturn_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class noReturn_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public noReturn_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "noReturn", org.apache.thrift.protocol.TMessageType.CALL, 0)); + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayHasArgs_call method_call = + new oneWayHasArgs_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayHasArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public oneWayHasArgs_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayHasArgs", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWay_call method_call = + new oneWay_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWay_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWay_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWay", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWay_args args = new oneWay_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayWithError_call method_call = + new oneWayWithError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayWithError_call + extends org.apache.thrift.async.TAsyncMethodCall { + public oneWayWithError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayWithError", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayWithError_args args = new oneWayWithError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + data_call method_call = + new data_call(user, account, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class data_call extends org.apache.thrift.async.TAsyncMethodCall { + private User user; + private Account account; + + public data_call( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.user = user; + this.account = account; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "data", org.apache.thrift.protocol.TMessageType.CALL, 0)); + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + args.write(prot); + prot.writeMessageEnd(); + } + + public UserAccount getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_data(); + } + } + } + + public static class Processor extends org.apache.thrift.TBaseProcessor + implements org.apache.thrift.TProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(Processor.class.getName()); + + public Processor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + java.lang.String, + org.apache.thrift.ProcessFunction>())); + } + + protected Processor( + I iface, + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + getProcessMap( + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.ProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public sayHello_result getResult(I iface, sayHello_args args) + throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + result.success = iface.sayHello(args.zone, args.name); + return result; + } + } + + public static class withDelay + extends org.apache.thrift.ProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withDelay_result getResult(I iface, withDelay_args args) + throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + result.success = iface.withDelay(args.delay); + return result; + } + } + + public static class withoutArgs + extends org.apache.thrift.ProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withoutArgs_result getResult(I iface, withoutArgs_args args) + throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + result.success = iface.withoutArgs(); + return result; + } + } + + public static class withError + extends org.apache.thrift.ProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withError_result getResult(I iface, withError_args args) + throws org.apache.thrift.TException { + withError_result result = new withError_result(); + result.success = iface.withError(); + return result; + } + } + + public static class withCollisioin + extends org.apache.thrift.ProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public withCollisioin_result getResult(I iface, withCollisioin_args args) + throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + result.success = iface.withCollisioin(args.input); + return result; + } + } + + public static class noReturn + extends org.apache.thrift.ProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public noReturn_result getResult(I iface, noReturn_args args) + throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + iface.noReturn(args.delay); + return result; + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.ProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayHasArgs_args args) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay); + return null; + } + } + + public static class oneWay + extends org.apache.thrift.ProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public org.apache.thrift.TBase getResult(I iface, oneWay_args args) + throws org.apache.thrift.TException { + iface.oneWay(); + return null; + } + } + + public static class oneWayWithError + extends org.apache.thrift.ProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayWithError_args args) + throws org.apache.thrift.TException { + iface.oneWayWithError(); + return null; + } + } + + public static class data + extends org.apache.thrift.ProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + public data_result getResult(I iface, data_args args) throws org.apache.thrift.TException { + data_result result = new data_result(); + result.success = iface.data(args.user, args.account); + return result; + } + } + } + + public static class AsyncProcessor + extends org.apache.thrift.TBaseAsyncProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(AsyncProcessor.class.getName()); + + public AsyncProcessor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>>())); + } + + protected AsyncProcessor( + I iface, + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction> + getProcessMap( + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.AsyncProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + sayHello_result result = new sayHello_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + sayHello_result result = new sayHello_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + sayHello_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.sayHello(args.zone, args.name, resultHandler); + } + } + + public static class withDelay + extends org.apache.thrift.AsyncProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withDelay_result result = new withDelay_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withDelay_result result = new withDelay_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withDelay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withDelay(args.delay, resultHandler); + } + } + + public static class withoutArgs + extends org.apache.thrift.AsyncProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withoutArgs_result result = new withoutArgs_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withoutArgs_result result = new withoutArgs_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withoutArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withoutArgs(resultHandler); + } + } + + public static class withError + extends org.apache.thrift.AsyncProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withError_result result = new withError_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withError_result result = new withError_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withError(resultHandler); + } + } + + public static class withCollisioin + extends org.apache.thrift.AsyncProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(java.lang.String o) { + withCollisioin_result result = new withCollisioin_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withCollisioin_result result = new withCollisioin_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withCollisioin_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withCollisioin(args.input, resultHandler); + } + } + + public static class noReturn + extends org.apache.thrift.AsyncProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) { + noReturn_result result = new noReturn_result(); + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + noReturn_result result = new noReturn_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + noReturn_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.noReturn(args.delay, resultHandler); + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.AsyncProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWayHasArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay, resultHandler); + } + } + + public static class oneWay + extends org.apache.thrift.AsyncProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWay(resultHandler); + } + } + + public static class oneWayWithError + extends org.apache.thrift.AsyncProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWayWithError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayWithError(resultHandler); + } + } + + public static class data + extends org.apache.thrift.AsyncProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + public void onComplete(UserAccount o) { + data_result result = new data_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + data_result result = new data_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + data_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.data(args.user, args.account, resultHandler); + } + } + } + + public static class sayHello_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_args"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String zone; // required + public @org.apache.thrift.annotation.Nullable java.lang.String name; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + NAME((short) 2, "name"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // NAME + return NAME; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_args.class, metaDataMap); + } + + public sayHello_args() {} + + public sayHello_args(java.lang.String zone, java.lang.String name) { + this(); + this.zone = zone; + this.name = name; + } + + /** Performs a deep copy on other. */ + public sayHello_args(sayHello_args other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetName()) { + this.name = other.name; + } + } + + public sayHello_args deepCopy() { + return new sayHello_args(this); + } + + @Override + public void clear() { + this.zone = null; + this.name = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getZone() { + return this.zone; + } + + public sayHello_args setZone(@org.apache.thrift.annotation.Nullable java.lang.String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getName() { + return this.name; + } + + public sayHello_args setName(@org.apache.thrift.annotation.Nullable java.lang.String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((java.lang.String) value); + } + break; + + case NAME: + if (value == null) { + unsetName(); + } else { + setName((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case NAME: + return getName(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case NAME: + return isSetName(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof sayHello_args) return this.equals((sayHello_args) that); + return false; + } + + public boolean equals(sayHello_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetZone(), other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetName(), other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("sayHello_args("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_argsStandardScheme getScheme() { + return new sayHello_argsStandardScheme(); + } + } + + private static class sayHello_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_argsTupleScheme getScheme() { + return new sayHello_argsTupleScheme(); + } + } + + private static class sayHello_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetZone()) { + optionals.set(0); + } + if (struct.isSetName()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetZone()) { + oprot.writeString(struct.zone); + } + if (struct.isSetName()) { + oprot.writeString(struct.name); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } + if (incoming.get(1)) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class sayHello_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_result.class, metaDataMap); + } + + public sayHello_result() {} + + public sayHello_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public sayHello_result(sayHello_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public sayHello_result deepCopy() { + return new sayHello_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public sayHello_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof sayHello_result) return this.equals((sayHello_result) that); + return false; + } + + public boolean equals(sayHello_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("sayHello_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_resultStandardScheme getScheme() { + return new sayHello_resultStandardScheme(); + } + } + + private static class sayHello_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public sayHello_resultTupleScheme getScheme() { + return new sayHello_resultTupleScheme(); + } + } + + private static class sayHello_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withDelay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_args.class, metaDataMap); + } + + public withDelay_args() {} + + public withDelay_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public withDelay_args(withDelay_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public withDelay_args deepCopy() { + return new withDelay_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public withDelay_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withDelay_args) return this.equals((withDelay_args) that); + return false; + } + + public boolean equals(withDelay_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(withDelay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withDelay_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_argsStandardScheme getScheme() { + return new withDelay_argsStandardScheme(); + } + } + + private static class withDelay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_argsTupleScheme getScheme() { + return new withDelay_argsTupleScheme(); + } + } + + private static class withDelay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withDelay_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_result.class, metaDataMap); + } + + public withDelay_result() {} + + public withDelay_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withDelay_result(withDelay_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withDelay_result deepCopy() { + return new withDelay_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withDelay_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withDelay_result) return this.equals((withDelay_result) that); + return false; + } + + public boolean equals(withDelay_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withDelay_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withDelay_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_resultStandardScheme getScheme() { + return new withDelay_resultStandardScheme(); + } + } + + private static class withDelay_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withDelay_resultTupleScheme getScheme() { + return new withDelay_resultTupleScheme(); + } + } + + private static class withDelay_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withoutArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_args.class, metaDataMap); + } + + public withoutArgs_args() {} + + /** Performs a deep copy on other. */ + public withoutArgs_args(withoutArgs_args other) {} + + public withoutArgs_args deepCopy() { + return new withoutArgs_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withoutArgs_args) return this.equals((withoutArgs_args) that); + return false; + } + + public boolean equals(withoutArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withoutArgs_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_argsStandardScheme getScheme() { + return new withoutArgs_argsStandardScheme(); + } + } + + private static class withoutArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_argsTupleScheme getScheme() { + return new withoutArgs_argsTupleScheme(); + } + } + + private static class withoutArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withoutArgs_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_result.class, metaDataMap); + } + + public withoutArgs_result() {} + + public withoutArgs_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withoutArgs_result(withoutArgs_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withoutArgs_result deepCopy() { + return new withoutArgs_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withoutArgs_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withoutArgs_result) return this.equals((withoutArgs_result) that); + return false; + } + + public boolean equals(withoutArgs_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withoutArgs_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_resultStandardScheme getScheme() { + return new withoutArgs_resultStandardScheme(); + } + } + + private static class withoutArgs_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withoutArgs_resultTupleScheme getScheme() { + return new withoutArgs_resultTupleScheme(); + } + } + + private static class withoutArgs_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_args.class, metaDataMap); + } + + public withError_args() {} + + /** Performs a deep copy on other. */ + public withError_args(withError_args other) {} + + public withError_args deepCopy() { + return new withError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withError_args) return this.equals((withError_args) that); + return false; + } + + public boolean equals(withError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_argsStandardScheme getScheme() { + return new withError_argsStandardScheme(); + } + } + + private static class withError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_argsTupleScheme getScheme() { + return new withError_argsTupleScheme(); + } + } + + private static class withError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withError_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_result.class, metaDataMap); + } + + public withError_result() {} + + public withError_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withError_result(withError_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withError_result deepCopy() { + return new withError_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withError_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withError_result) return this.equals((withError_result) that); + return false; + } + + public boolean equals(withError_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withError_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withError_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_resultStandardScheme getScheme() { + return new withError_resultStandardScheme(); + } + } + + private static class withError_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withError_resultTupleScheme getScheme() { + return new withError_resultTupleScheme(); + } + } + + private static class withError_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withCollisioin_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_args"); + + private static final org.apache.thrift.protocol.TField INPUT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "input", org.apache.thrift.protocol.TType.STRING, (short) 3333); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String input; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + INPUT((short) 3333, "input"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 3333: // INPUT + return INPUT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.INPUT, + new org.apache.thrift.meta_data.FieldMetaData( + "input", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_args.class, metaDataMap); + } + + public withCollisioin_args() {} + + public withCollisioin_args(java.lang.String input) { + this(); + this.input = input; + } + + /** Performs a deep copy on other. */ + public withCollisioin_args(withCollisioin_args other) { + if (other.isSetInput()) { + this.input = other.input; + } + } + + public withCollisioin_args deepCopy() { + return new withCollisioin_args(this); + } + + @Override + public void clear() { + this.input = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getInput() { + return this.input; + } + + public withCollisioin_args setInput( + @org.apache.thrift.annotation.Nullable java.lang.String input) { + this.input = input; + return this; + } + + public void unsetInput() { + this.input = null; + } + + /** Returns true if field input is set (has been assigned a value) and false otherwise */ + public boolean isSetInput() { + return this.input != null; + } + + public void setInputIsSet(boolean value) { + if (!value) { + this.input = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case INPUT: + if (value == null) { + unsetInput(); + } else { + setInput((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case INPUT: + return getInput(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case INPUT: + return isSetInput(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withCollisioin_args) return this.equals((withCollisioin_args) that); + return false; + } + + public boolean equals(withCollisioin_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_input = true && this.isSetInput(); + boolean that_present_input = true && that.isSetInput(); + if (this_present_input || that_present_input) { + if (!(this_present_input && that_present_input)) return false; + if (!this.input.equals(that.input)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetInput()) ? 131071 : 524287); + if (isSetInput()) hashCode = hashCode * 8191 + input.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetInput(), other.isSetInput()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInput()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.input, other.input); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withCollisioin_args("); + boolean first = true; + + sb.append("input:"); + if (this.input == null) { + sb.append("null"); + } else { + sb.append(this.input); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_argsStandardScheme getScheme() { + return new withCollisioin_argsStandardScheme(); + } + } + + private static class withCollisioin_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 3333: // INPUT + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.input != null) { + oprot.writeFieldBegin(INPUT_FIELD_DESC); + oprot.writeString(struct.input); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_argsTupleScheme getScheme() { + return new withCollisioin_argsTupleScheme(); + } + } + + private static class withCollisioin_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetInput()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetInput()) { + oprot.writeString(struct.input); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class withCollisioin_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_result.class, metaDataMap); + } + + public withCollisioin_result() {} + + public withCollisioin_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withCollisioin_result(withCollisioin_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withCollisioin_result deepCopy() { + return new withCollisioin_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withCollisioin_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withCollisioin_result) return this.equals((withCollisioin_result) that); + return false; + } + + public boolean equals(withCollisioin_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withCollisioin_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_resultStandardScheme getScheme() { + return new withCollisioin_resultStandardScheme(); + } + } + + private static class withCollisioin_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public withCollisioin_resultTupleScheme getScheme() { + return new withCollisioin_resultTupleScheme(); + } + } + + private static class withCollisioin_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class noReturn_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_args.class, metaDataMap); + } + + public noReturn_args() {} + + public noReturn_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public noReturn_args(noReturn_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public noReturn_args deepCopy() { + return new noReturn_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public noReturn_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof noReturn_args) return this.equals((noReturn_args) that); + return false; + } + + public boolean equals(noReturn_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(noReturn_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("noReturn_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_argsStandardScheme getScheme() { + return new noReturn_argsStandardScheme(); + } + } + + private static class noReturn_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_argsTupleScheme getScheme() { + return new noReturn_argsTupleScheme(); + } + } + + private static class noReturn_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class noReturn_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_result"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_resultTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_result.class, metaDataMap); + } + + public noReturn_result() {} + + /** Performs a deep copy on other. */ + public noReturn_result(noReturn_result other) {} + + public noReturn_result deepCopy() { + return new noReturn_result(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof noReturn_result) return this.equals((noReturn_result) that); + return false; + } + + public boolean equals(noReturn_result that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(noReturn_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("noReturn_result("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_resultStandardScheme getScheme() { + return new noReturn_resultStandardScheme(); + } + } + + private static class noReturn_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public noReturn_resultTupleScheme getScheme() { + return new noReturn_resultTupleScheme(); + } + } + + private static class noReturn_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class oneWayHasArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayHasArgs_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayHasArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayHasArgs_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayHasArgs_args.class, metaDataMap); + } + + public oneWayHasArgs_args() {} + + public oneWayHasArgs_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public oneWayHasArgs_args(oneWayHasArgs_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public oneWayHasArgs_args deepCopy() { + return new oneWayHasArgs_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public oneWayHasArgs_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWayHasArgs_args) return this.equals((oneWayHasArgs_args) that); + return false; + } + + public boolean equals(oneWayHasArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(oneWayHasArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWayHasArgs_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayHasArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayHasArgs_argsStandardScheme getScheme() { + return new oneWayHasArgs_argsStandardScheme(); + } + } + + private static class oneWayHasArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayHasArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayHasArgs_argsTupleScheme getScheme() { + return new oneWayHasArgs_argsTupleScheme(); + } + } + + private static class oneWayHasArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class oneWay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWay_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWay_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWay_args.class, metaDataMap); + } + + public oneWay_args() {} + + /** Performs a deep copy on other. */ + public oneWay_args(oneWay_args other) {} + + public oneWay_args deepCopy() { + return new oneWay_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWay_args) return this.equals((oneWay_args) that); + return false; + } + + public boolean equals(oneWay_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWay_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWay_argsStandardScheme getScheme() { + return new oneWay_argsStandardScheme(); + } + } + + private static class oneWay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWay_argsTupleScheme getScheme() { + return new oneWay_argsTupleScheme(); + } + } + + private static class oneWay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class oneWayWithError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayWithError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayWithError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayWithError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayWithError_args.class, metaDataMap); + } + + public oneWayWithError_args() {} + + /** Performs a deep copy on other. */ + public oneWayWithError_args(oneWayWithError_args other) {} + + public oneWayWithError_args deepCopy() { + return new oneWayWithError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWayWithError_args) return this.equals((oneWayWithError_args) that); + return false; + } + + public boolean equals(oneWayWithError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWayWithError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWayWithError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayWithError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayWithError_argsStandardScheme getScheme() { + return new oneWayWithError_argsStandardScheme(); + } + } + + private static class oneWayWithError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayWithError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public oneWayWithError_argsTupleScheme getScheme() { + return new oneWayWithError_argsTupleScheme(); + } + } + + private static class oneWayWithError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class data_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_args"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable User user; // required + public @org.apache.thrift.annotation.Nullable Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(data_args.class, metaDataMap); + } + + public data_args() {} + + public data_args(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public data_args(data_args other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public data_args deepCopy() { + return new data_args(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + @org.apache.thrift.annotation.Nullable + public User getUser() { + return this.user; + } + + public data_args setUser(@org.apache.thrift.annotation.Nullable User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + @org.apache.thrift.annotation.Nullable + public Account getAccount() { + return this.account; + } + + public data_args setAccount(@org.apache.thrift.annotation.Nullable Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof data_args) return this.equals((data_args) that); + return false; + } + + public boolean equals(data_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetUser(), other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAccount(), other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("data_args("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_argsStandardScheme getScheme() { + return new data_argsStandardScheme(); + } + } + + private static class data_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_argsTupleScheme getScheme() { + return new data_argsTupleScheme(); + } + } + + private static class data_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetUser()) { + optionals.set(0); + } + if (struct.isSetAccount()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetUser()) { + struct.user.write(oprot); + } + if (struct.isSetAccount()) { + struct.account.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } + if (incoming.get(1)) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + public static class data_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRUCT, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable UserAccount success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, UserAccount.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + data_result.class, metaDataMap); + } + + public data_result() {} + + public data_result(UserAccount success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public data_result(data_result other) { + if (other.isSetSuccess()) { + this.success = new UserAccount(other.success); + } + } + + public data_result deepCopy() { + return new data_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public UserAccount getSuccess() { + return this.success; + } + + public data_result setSuccess(@org.apache.thrift.annotation.Nullable UserAccount success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((UserAccount) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof data_result) return this.equals((data_result) that); + return false; + } + + public boolean equals(data_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("data_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_resultStandardScheme getScheme() { + return new data_resultStandardScheme(); + } + } + + private static class data_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public data_resultTupleScheme getScheme() { + return new data_resultTupleScheme(); + } + } + + private static class data_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_16_0/User.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_16_0/User.java new file mode 100644 index 000000000000..bf833a908b08 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_16_0/User.java @@ -0,0 +1,596 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_16_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.16.0)", + date = "2025-02-27") +public class User + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("User"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "userId", org.apache.thrift.protocol.TType.STRING, (short) 2); + private static final org.apache.thrift.protocol.TField AGE_FIELD_DESC = + new org.apache.thrift.protocol.TField("age", org.apache.thrift.protocol.TType.I32, (short) 3); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String name; // required + public @org.apache.thrift.annotation.Nullable java.lang.String userId; // required + public int age; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + NAME((short) 1, "name"), + USER_ID((short) 2, "userId"), + AGE((short) 3, "age"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // NAME + return NAME; + case 2: // USER_ID + return USER_ID; + case 3: // AGE + return AGE; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __AGE_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.USER_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "userId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.AGE, + new org.apache.thrift.meta_data.FieldMetaData( + "age", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(User.class, metaDataMap); + } + + public User() {} + + public User(java.lang.String name, java.lang.String userId, int age) { + this(); + this.name = name; + this.userId = userId; + this.age = age; + setAgeIsSet(true); + } + + /** Performs a deep copy on other. */ + public User(User other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetName()) { + this.name = other.name; + } + if (other.isSetUserId()) { + this.userId = other.userId; + } + this.age = other.age; + } + + public User deepCopy() { + return new User(this); + } + + @Override + public void clear() { + this.name = null; + this.userId = null; + setAgeIsSet(false); + this.age = 0; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getName() { + return this.name; + } + + public User setName(@org.apache.thrift.annotation.Nullable java.lang.String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getUserId() { + return this.userId; + } + + public User setUserId(@org.apache.thrift.annotation.Nullable java.lang.String userId) { + this.userId = userId; + return this; + } + + public void unsetUserId() { + this.userId = null; + } + + /** Returns true if field userId is set (has been assigned a value) and false otherwise */ + public boolean isSetUserId() { + return this.userId != null; + } + + public void setUserIdIsSet(boolean value) { + if (!value) { + this.userId = null; + } + } + + public int getAge() { + return this.age; + } + + public User setAge(int age) { + this.age = age; + setAgeIsSet(true); + return this; + } + + public void unsetAge() { + __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __AGE_ISSET_ID); + } + + /** Returns true if field age is set (has been assigned a value) and false otherwise */ + public boolean isSetAge() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __AGE_ISSET_ID); + } + + public void setAgeIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __AGE_ISSET_ID, value); + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case NAME: + if (value == null) { + unsetName(); + } else { + setName((java.lang.String) value); + } + break; + + case USER_ID: + if (value == null) { + unsetUserId(); + } else { + setUserId((java.lang.String) value); + } + break; + + case AGE: + if (value == null) { + unsetAge(); + } else { + setAge((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case NAME: + return getName(); + + case USER_ID: + return getUserId(); + + case AGE: + return getAge(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case NAME: + return isSetName(); + case USER_ID: + return isSetUserId(); + case AGE: + return isSetAge(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof User) return this.equals((User) that); + return false; + } + + public boolean equals(User that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + boolean this_present_userId = true && this.isSetUserId(); + boolean that_present_userId = true && that.isSetUserId(); + if (this_present_userId || that_present_userId) { + if (!(this_present_userId && that_present_userId)) return false; + if (!this.userId.equals(that.userId)) return false; + } + + boolean this_present_age = true; + boolean that_present_age = true; + if (this_present_age || that_present_age) { + if (!(this_present_age && that_present_age)) return false; + if (this.age != that.age) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + hashCode = hashCode * 8191 + ((isSetUserId()) ? 131071 : 524287); + if (isSetUserId()) hashCode = hashCode * 8191 + userId.hashCode(); + + hashCode = hashCode * 8191 + age; + + return hashCode; + } + + @Override + public int compareTo(User other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetName(), other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetUserId(), other.isSetUserId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAge(), other.isSetAge()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAge()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.age, other.age); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("User("); + boolean first = true; + + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + if (!first) sb.append(", "); + sb.append("userId:"); + if (this.userId == null) { + sb.append("null"); + } else { + sb.append(this.userId); + } + first = false; + if (!first) sb.append(", "); + sb.append("age:"); + sb.append(this.age); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (name == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'name' was not present! Struct: " + toString()); + } + if (userId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'userId' was not present! Struct: " + toString()); + } + // alas, we cannot check 'age' because it's a primitive and you chose the non-beans generator. + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public UserStandardScheme getScheme() { + return new UserStandardScheme(); + } + } + + private static class UserStandardScheme extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // AGE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + if (!struct.isSetAge()) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'age' was not found in serialized data! Struct: " + toString()); + } + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, User struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + if (struct.userId != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userId); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(AGE_FIELD_DESC); + oprot.writeI32(struct.age); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + public UserTupleScheme getScheme() { + return new UserTupleScheme(); + } + } + + private static class UserTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.name); + oprot.writeString(struct.userId); + oprot.writeI32(struct.age); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.name = iprot.readString(); + struct.setNameIsSet(true); + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_16_0/UserAccount.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_16_0/UserAccount.java new file mode 100644 index 000000000000..311a6ac78514 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_16_0/UserAccount.java @@ -0,0 +1,507 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_16_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.16.0)", + date = "2025-02-27") +public class UserAccount + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("UserAccount"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserAccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserAccountTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable User user; // required + public @org.apache.thrift.annotation.Nullable Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserAccount.class, metaDataMap); + } + + public UserAccount() {} + + public UserAccount(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public UserAccount(UserAccount other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public UserAccount deepCopy() { + return new UserAccount(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + @org.apache.thrift.annotation.Nullable + public User getUser() { + return this.user; + } + + public UserAccount setUser(@org.apache.thrift.annotation.Nullable User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + @org.apache.thrift.annotation.Nullable + public Account getAccount() { + return this.account; + } + + public UserAccount setAccount(@org.apache.thrift.annotation.Nullable Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof UserAccount) return this.equals((UserAccount) that); + return false; + } + + public boolean equals(UserAccount that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(UserAccount other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetUser(), other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAccount(), other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("UserAccount("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (user == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'user' was not present! Struct: " + toString()); + } + if (account == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'account' was not present! Struct: " + toString()); + } + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserAccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public UserAccountStandardScheme getScheme() { + return new UserAccountStandardScheme(); + } + } + + private static class UserAccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, UserAccount struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserAccountTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + public UserAccountTupleScheme getScheme() { + return new UserAccountTupleScheme(); + } + } + + private static class UserAccountTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user.write(oprot); + struct.account.write(oprot); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_17_0/Account.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_17_0/Account.java new file mode 100644 index 000000000000..e6e007185dc7 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_17_0/Account.java @@ -0,0 +1,508 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_17_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.17.0)", + date = "2025-02-27") +public class Account + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("Account"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField CARD_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "cardId", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new AccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new AccountTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String zone; // required + public @org.apache.thrift.annotation.Nullable java.lang.String cardId; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + CARD_ID((short) 2, "cardId"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // CARD_ID + return CARD_ID; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.CARD_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "cardId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Account.class, metaDataMap); + } + + public Account() {} + + public Account(java.lang.String zone, java.lang.String cardId) { + this(); + this.zone = zone; + this.cardId = cardId; + } + + /** Performs a deep copy on other. */ + public Account(Account other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetCardId()) { + this.cardId = other.cardId; + } + } + + @Override + public Account deepCopy() { + return new Account(this); + } + + @Override + public void clear() { + this.zone = null; + this.cardId = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getZone() { + return this.zone; + } + + public Account setZone(@org.apache.thrift.annotation.Nullable java.lang.String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getCardId() { + return this.cardId; + } + + public Account setCardId(@org.apache.thrift.annotation.Nullable java.lang.String cardId) { + this.cardId = cardId; + return this; + } + + public void unsetCardId() { + this.cardId = null; + } + + /** Returns true if field cardId is set (has been assigned a value) and false otherwise */ + public boolean isSetCardId() { + return this.cardId != null; + } + + public void setCardIdIsSet(boolean value) { + if (!value) { + this.cardId = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((java.lang.String) value); + } + break; + + case CARD_ID: + if (value == null) { + unsetCardId(); + } else { + setCardId((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case CARD_ID: + return getCardId(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case CARD_ID: + return isSetCardId(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof Account) return this.equals((Account) that); + return false; + } + + public boolean equals(Account that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_cardId = true && this.isSetCardId(); + boolean that_present_cardId = true && that.isSetCardId(); + if (this_present_cardId || that_present_cardId) { + if (!(this_present_cardId && that_present_cardId)) return false; + if (!this.cardId.equals(that.cardId)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetCardId()) ? 131071 : 524287); + if (isSetCardId()) hashCode = hashCode * 8191 + cardId.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(Account other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetZone(), other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetCardId(), other.isSetCardId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCardId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cardId, other.cardId); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("Account("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("cardId:"); + if (this.cardId == null) { + sb.append("null"); + } else { + sb.append(this.cardId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (zone == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'zone' was not present! Struct: " + toString()); + } + if (cardId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'cardId' was not present! Struct: " + toString()); + } + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class AccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public AccountStandardScheme getScheme() { + return new AccountStandardScheme(); + } + } + + private static class AccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // CARD_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, Account struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.cardId != null) { + oprot.writeFieldBegin(CARD_ID_FIELD_DESC); + oprot.writeString(struct.cardId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class AccountTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + @Override + public AccountTupleScheme getScheme() { + return new AccountTupleScheme(); + } + } + + private static class AccountTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.zone); + oprot.writeString(struct.cardId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_17_0/ThriftService.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_17_0/ThriftService.java new file mode 100644 index 000000000000..202f0a433749 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_17_0/ThriftService.java @@ -0,0 +1,8475 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_17_0; + +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.17.0)", + date = "2025-02-27") +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +public class ThriftService { + + public interface Iface { + + public java.lang.String sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException; + + public java.lang.String withDelay(int delay) throws org.apache.thrift.TException; + + public java.lang.String withoutArgs() throws org.apache.thrift.TException; + + public java.lang.String withError() throws org.apache.thrift.TException; + + public java.lang.String withCollisioin(java.lang.String input) + throws org.apache.thrift.TException; + + public void noReturn(int delay) throws org.apache.thrift.TException; + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException; + + public void oneWay() throws org.apache.thrift.TException; + + public void oneWayWithError() throws org.apache.thrift.TException; + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException; + } + + public interface AsyncIface { + + public void sayHello( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withCollisioin( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + } + + public static class Client extends org.apache.thrift.TServiceClient implements Iface { + public static class Factory implements org.apache.thrift.TServiceClientFactory { + public Factory() {} + + @Override + public Client getClient(org.apache.thrift.protocol.TProtocol prot) { + return new Client(prot); + } + + @Override + public Client getClient( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + return new Client(iprot, oprot); + } + } + + public Client(org.apache.thrift.protocol.TProtocol prot) { + super(prot, prot); + } + + public Client( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + super(iprot, oprot); + } + + @Override + public java.lang.String sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException { + send_sayHello(zone, name); + return recv_sayHello(); + } + + public void send_sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException { + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + sendBase("sayHello", args); + } + + public java.lang.String recv_sayHello() throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + receiveBase(result, "sayHello"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "sayHello failed: unknown result"); + } + + @Override + public java.lang.String withDelay(int delay) throws org.apache.thrift.TException { + send_withDelay(delay); + return recv_withDelay(); + } + + public void send_withDelay(int delay) throws org.apache.thrift.TException { + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + sendBase("withDelay", args); + } + + public java.lang.String recv_withDelay() throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + receiveBase(result, "withDelay"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withDelay failed: unknown result"); + } + + @Override + public java.lang.String withoutArgs() throws org.apache.thrift.TException { + send_withoutArgs(); + return recv_withoutArgs(); + } + + public void send_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_args args = new withoutArgs_args(); + sendBase("withoutArgs", args); + } + + public java.lang.String recv_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + receiveBase(result, "withoutArgs"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withoutArgs failed: unknown result"); + } + + @Override + public java.lang.String withError() throws org.apache.thrift.TException { + send_withError(); + return recv_withError(); + } + + public void send_withError() throws org.apache.thrift.TException { + withError_args args = new withError_args(); + sendBase("withError", args); + } + + public java.lang.String recv_withError() throws org.apache.thrift.TException { + withError_result result = new withError_result(); + receiveBase(result, "withError"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withError failed: unknown result"); + } + + @Override + public java.lang.String withCollisioin(java.lang.String input) + throws org.apache.thrift.TException { + send_withCollisioin(input); + return recv_withCollisioin(); + } + + public void send_withCollisioin(java.lang.String input) throws org.apache.thrift.TException { + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + sendBase("withCollisioin", args); + } + + public java.lang.String recv_withCollisioin() throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + receiveBase(result, "withCollisioin"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withCollisioin failed: unknown result"); + } + + @Override + public void noReturn(int delay) throws org.apache.thrift.TException { + send_noReturn(delay); + recv_noReturn(); + } + + public void send_noReturn(int delay) throws org.apache.thrift.TException { + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + sendBase("noReturn", args); + } + + public void recv_noReturn() throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + receiveBase(result, "noReturn"); + return; + } + + @Override + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException { + send_oneWayHasArgs(delay); + } + + public void send_oneWayHasArgs(int delay) throws org.apache.thrift.TException { + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + sendBaseOneway("oneWayHasArgs", args); + } + + @Override + public void oneWay() throws org.apache.thrift.TException { + send_oneWay(); + } + + public void send_oneWay() throws org.apache.thrift.TException { + oneWay_args args = new oneWay_args(); + sendBaseOneway("oneWay", args); + } + + @Override + public void oneWayWithError() throws org.apache.thrift.TException { + send_oneWayWithError(); + } + + public void send_oneWayWithError() throws org.apache.thrift.TException { + oneWayWithError_args args = new oneWayWithError_args(); + sendBaseOneway("oneWayWithError", args); + } + + @Override + public UserAccount data(User user, Account account) throws org.apache.thrift.TException { + send_data(user, account); + return recv_data(); + } + + public void send_data(User user, Account account) throws org.apache.thrift.TException { + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + sendBase("data", args); + } + + public UserAccount recv_data() throws org.apache.thrift.TException { + data_result result = new data_result(); + receiveBase(result, "data"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, "data failed: unknown result"); + } + } + + public static class AsyncClient extends org.apache.thrift.async.TAsyncClient + implements AsyncIface { + public static class Factory + implements org.apache.thrift.async.TAsyncClientFactory { + private org.apache.thrift.async.TAsyncClientManager clientManager; + private org.apache.thrift.protocol.TProtocolFactory protocolFactory; + + public Factory( + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.protocol.TProtocolFactory protocolFactory) { + this.clientManager = clientManager; + this.protocolFactory = protocolFactory; + } + + @Override + public AsyncClient getAsyncClient( + org.apache.thrift.transport.TNonblockingTransport transport) { + return new AsyncClient(protocolFactory, clientManager, transport); + } + } + + public AsyncClient( + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.transport.TNonblockingTransport transport) { + super(protocolFactory, clientManager, transport); + } + + @Override + public void sayHello( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + sayHello_call method_call = + new sayHello_call(zone, name, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class sayHello_call + extends org.apache.thrift.async.TAsyncMethodCall { + private java.lang.String zone; + private java.lang.String name; + + public sayHello_call( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.zone = zone; + this.name = name; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "sayHello", org.apache.thrift.protocol.TMessageType.CALL, 0)); + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_sayHello(); + } + } + + @Override + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withDelay_call method_call = + new withDelay_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withDelay_call + extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public withDelay_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withDelay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withDelay(); + } + } + + @Override + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withoutArgs_call method_call = + new withoutArgs_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withoutArgs_call + extends org.apache.thrift.async.TAsyncMethodCall { + public withoutArgs_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withoutArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withoutArgs_args args = new withoutArgs_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withoutArgs(); + } + } + + @Override + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withError_call method_call = + new withError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withError_call + extends org.apache.thrift.async.TAsyncMethodCall { + public withError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withError_args args = new withError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withError(); + } + } + + @Override + public void withCollisioin( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withCollisioin_call method_call = + new withCollisioin_call(input, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withCollisioin_call + extends org.apache.thrift.async.TAsyncMethodCall { + private java.lang.String input; + + public withCollisioin_call( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.input = input; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withCollisioin", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withCollisioin(); + } + } + + @Override + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + noReturn_call method_call = + new noReturn_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class noReturn_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public noReturn_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "noReturn", org.apache.thrift.protocol.TMessageType.CALL, 0)); + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + (new Client(prot)).recv_noReturn(); + return null; + } + } + + @Override + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayHasArgs_call method_call = + new oneWayHasArgs_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayHasArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public oneWayHasArgs_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + this.delay = delay; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayHasArgs", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + @Override + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWay_call method_call = + new oneWay_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWay_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWay_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWay", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWay_args args = new oneWay_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + @Override + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayWithError_call method_call = + new oneWayWithError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayWithError_call + extends org.apache.thrift.async.TAsyncMethodCall { + public oneWayWithError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayWithError", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayWithError_args args = new oneWayWithError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + @Override + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + data_call method_call = + new data_call(user, account, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class data_call extends org.apache.thrift.async.TAsyncMethodCall { + private User user; + private Account account; + + public data_call( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.user = user; + this.account = account; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "data", org.apache.thrift.protocol.TMessageType.CALL, 0)); + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public UserAccount getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_data(); + } + } + } + + public static class Processor extends org.apache.thrift.TBaseProcessor + implements org.apache.thrift.TProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(Processor.class.getName()); + + public Processor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + java.lang.String, + org.apache.thrift.ProcessFunction>())); + } + + protected Processor( + I iface, + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + getProcessMap( + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.ProcessFunction { + public sayHello() { + super("sayHello"); + } + + @Override + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public sayHello_result getResult(I iface, sayHello_args args) + throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + result.success = iface.sayHello(args.zone, args.name); + return result; + } + } + + public static class withDelay + extends org.apache.thrift.ProcessFunction { + public withDelay() { + super("withDelay"); + } + + @Override + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public withDelay_result getResult(I iface, withDelay_args args) + throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + result.success = iface.withDelay(args.delay); + return result; + } + } + + public static class withoutArgs + extends org.apache.thrift.ProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + @Override + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public withoutArgs_result getResult(I iface, withoutArgs_args args) + throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + result.success = iface.withoutArgs(); + return result; + } + } + + public static class withError + extends org.apache.thrift.ProcessFunction { + public withError() { + super("withError"); + } + + @Override + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public withError_result getResult(I iface, withError_args args) + throws org.apache.thrift.TException { + withError_result result = new withError_result(); + result.success = iface.withError(); + return result; + } + } + + public static class withCollisioin + extends org.apache.thrift.ProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + @Override + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public withCollisioin_result getResult(I iface, withCollisioin_args args) + throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + result.success = iface.withCollisioin(args.input); + return result; + } + } + + public static class noReturn + extends org.apache.thrift.ProcessFunction { + public noReturn() { + super("noReturn"); + } + + @Override + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public noReturn_result getResult(I iface, noReturn_args args) + throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + iface.noReturn(args.delay); + return result; + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.ProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + @Override + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + @Override + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public org.apache.thrift.TBase getResult(I iface, oneWayHasArgs_args args) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay); + return null; + } + } + + public static class oneWay + extends org.apache.thrift.ProcessFunction { + public oneWay() { + super("oneWay"); + } + + @Override + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + @Override + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public org.apache.thrift.TBase getResult(I iface, oneWay_args args) + throws org.apache.thrift.TException { + iface.oneWay(); + return null; + } + } + + public static class oneWayWithError + extends org.apache.thrift.ProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + @Override + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + @Override + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public org.apache.thrift.TBase getResult(I iface, oneWayWithError_args args) + throws org.apache.thrift.TException { + iface.oneWayWithError(); + return null; + } + } + + public static class data + extends org.apache.thrift.ProcessFunction { + public data() { + super("data"); + } + + @Override + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public data_result getResult(I iface, data_args args) throws org.apache.thrift.TException { + data_result result = new data_result(); + result.success = iface.data(args.user, args.account); + return result; + } + } + } + + public static class AsyncProcessor + extends org.apache.thrift.TBaseAsyncProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(AsyncProcessor.class.getName()); + + public AsyncProcessor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>>())); + } + + protected AsyncProcessor( + I iface, + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction> + getProcessMap( + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.AsyncProcessFunction { + public sayHello() { + super("sayHello"); + } + + @Override + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(java.lang.String o) { + sayHello_result result = new sayHello_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + sayHello_result result = new sayHello_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + sayHello_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.sayHello(args.zone, args.name, resultHandler); + } + } + + public static class withDelay + extends org.apache.thrift.AsyncProcessFunction { + public withDelay() { + super("withDelay"); + } + + @Override + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(java.lang.String o) { + withDelay_result result = new withDelay_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withDelay_result result = new withDelay_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + withDelay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withDelay(args.delay, resultHandler); + } + } + + public static class withoutArgs + extends org.apache.thrift.AsyncProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + @Override + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(java.lang.String o) { + withoutArgs_result result = new withoutArgs_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withoutArgs_result result = new withoutArgs_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + withoutArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withoutArgs(resultHandler); + } + } + + public static class withError + extends org.apache.thrift.AsyncProcessFunction { + public withError() { + super("withError"); + } + + @Override + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(java.lang.String o) { + withError_result result = new withError_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withError_result result = new withError_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + withError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withError(resultHandler); + } + } + + public static class withCollisioin + extends org.apache.thrift.AsyncProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + @Override + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(java.lang.String o) { + withCollisioin_result result = new withCollisioin_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withCollisioin_result result = new withCollisioin_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + withCollisioin_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withCollisioin(args.input, resultHandler); + } + } + + public static class noReturn + extends org.apache.thrift.AsyncProcessFunction { + public noReturn() { + super("noReturn"); + } + + @Override + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(Void o) { + noReturn_result result = new noReturn_result(); + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + noReturn_result result = new noReturn_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + noReturn_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.noReturn(args.delay, resultHandler); + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.AsyncProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + @Override + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(Void o) {} + + @Override + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + @Override + protected boolean isOneway() { + return true; + } + + @Override + public void start( + I iface, + oneWayHasArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay, resultHandler); + } + } + + public static class oneWay + extends org.apache.thrift.AsyncProcessFunction { + public oneWay() { + super("oneWay"); + } + + @Override + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(Void o) {} + + @Override + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + @Override + protected boolean isOneway() { + return true; + } + + @Override + public void start( + I iface, + oneWay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWay(resultHandler); + } + } + + public static class oneWayWithError + extends org.apache.thrift.AsyncProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + @Override + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(Void o) {} + + @Override + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + @Override + protected boolean isOneway() { + return true; + } + + @Override + public void start( + I iface, + oneWayWithError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayWithError(resultHandler); + } + } + + public static class data + extends org.apache.thrift.AsyncProcessFunction { + public data() { + super("data"); + } + + @Override + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(UserAccount o) { + data_result result = new data_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + data_result result = new data_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + data_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.data(args.user, args.account, resultHandler); + } + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class sayHello_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_args"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String zone; // required + public @org.apache.thrift.annotation.Nullable java.lang.String name; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + NAME((short) 2, "name"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // NAME + return NAME; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_args.class, metaDataMap); + } + + public sayHello_args() {} + + public sayHello_args(java.lang.String zone, java.lang.String name) { + this(); + this.zone = zone; + this.name = name; + } + + /** Performs a deep copy on other. */ + public sayHello_args(sayHello_args other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetName()) { + this.name = other.name; + } + } + + @Override + public sayHello_args deepCopy() { + return new sayHello_args(this); + } + + @Override + public void clear() { + this.zone = null; + this.name = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getZone() { + return this.zone; + } + + public sayHello_args setZone(@org.apache.thrift.annotation.Nullable java.lang.String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getName() { + return this.name; + } + + public sayHello_args setName(@org.apache.thrift.annotation.Nullable java.lang.String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((java.lang.String) value); + } + break; + + case NAME: + if (value == null) { + unsetName(); + } else { + setName((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case NAME: + return getName(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case NAME: + return isSetName(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof sayHello_args) return this.equals((sayHello_args) that); + return false; + } + + public boolean equals(sayHello_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetZone(), other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetName(), other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("sayHello_args("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public sayHello_argsStandardScheme getScheme() { + return new sayHello_argsStandardScheme(); + } + } + + private static class sayHello_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public sayHello_argsTupleScheme getScheme() { + return new sayHello_argsTupleScheme(); + } + } + + private static class sayHello_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetZone()) { + optionals.set(0); + } + if (struct.isSetName()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetZone()) { + oprot.writeString(struct.zone); + } + if (struct.isSetName()) { + oprot.writeString(struct.name); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } + if (incoming.get(1)) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class sayHello_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_result.class, metaDataMap); + } + + public sayHello_result() {} + + public sayHello_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public sayHello_result(sayHello_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + @Override + public sayHello_result deepCopy() { + return new sayHello_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public sayHello_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof sayHello_result) return this.equals((sayHello_result) that); + return false; + } + + public boolean equals(sayHello_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("sayHello_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public sayHello_resultStandardScheme getScheme() { + return new sayHello_resultStandardScheme(); + } + } + + private static class sayHello_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public sayHello_resultTupleScheme getScheme() { + return new sayHello_resultTupleScheme(); + } + } + + private static class sayHello_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withDelay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_args.class, metaDataMap); + } + + public withDelay_args() {} + + public withDelay_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public withDelay_args(withDelay_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + @Override + public withDelay_args deepCopy() { + return new withDelay_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public withDelay_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withDelay_args) return this.equals((withDelay_args) that); + return false; + } + + public boolean equals(withDelay_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(withDelay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withDelay_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withDelay_argsStandardScheme getScheme() { + return new withDelay_argsStandardScheme(); + } + } + + private static class withDelay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withDelay_argsTupleScheme getScheme() { + return new withDelay_argsTupleScheme(); + } + } + + private static class withDelay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withDelay_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_result.class, metaDataMap); + } + + public withDelay_result() {} + + public withDelay_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withDelay_result(withDelay_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + @Override + public withDelay_result deepCopy() { + return new withDelay_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withDelay_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withDelay_result) return this.equals((withDelay_result) that); + return false; + } + + public boolean equals(withDelay_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withDelay_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withDelay_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withDelay_resultStandardScheme getScheme() { + return new withDelay_resultStandardScheme(); + } + } + + private static class withDelay_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withDelay_resultTupleScheme getScheme() { + return new withDelay_resultTupleScheme(); + } + } + + private static class withDelay_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withoutArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_args.class, metaDataMap); + } + + public withoutArgs_args() {} + + /** Performs a deep copy on other. */ + public withoutArgs_args(withoutArgs_args other) {} + + @Override + public withoutArgs_args deepCopy() { + return new withoutArgs_args(this); + } + + @Override + public void clear() {} + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withoutArgs_args) return this.equals((withoutArgs_args) that); + return false; + } + + public boolean equals(withoutArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withoutArgs_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withoutArgs_argsStandardScheme getScheme() { + return new withoutArgs_argsStandardScheme(); + } + } + + private static class withoutArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withoutArgs_argsTupleScheme getScheme() { + return new withoutArgs_argsTupleScheme(); + } + } + + private static class withoutArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withoutArgs_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_result.class, metaDataMap); + } + + public withoutArgs_result() {} + + public withoutArgs_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withoutArgs_result(withoutArgs_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + @Override + public withoutArgs_result deepCopy() { + return new withoutArgs_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withoutArgs_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withoutArgs_result) return this.equals((withoutArgs_result) that); + return false; + } + + public boolean equals(withoutArgs_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withoutArgs_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withoutArgs_resultStandardScheme getScheme() { + return new withoutArgs_resultStandardScheme(); + } + } + + private static class withoutArgs_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withoutArgs_resultTupleScheme getScheme() { + return new withoutArgs_resultTupleScheme(); + } + } + + private static class withoutArgs_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_args.class, metaDataMap); + } + + public withError_args() {} + + /** Performs a deep copy on other. */ + public withError_args(withError_args other) {} + + @Override + public withError_args deepCopy() { + return new withError_args(this); + } + + @Override + public void clear() {} + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withError_args) return this.equals((withError_args) that); + return false; + } + + public boolean equals(withError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withError_argsStandardScheme getScheme() { + return new withError_argsStandardScheme(); + } + } + + private static class withError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withError_argsTupleScheme getScheme() { + return new withError_argsTupleScheme(); + } + } + + private static class withError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withError_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_result.class, metaDataMap); + } + + public withError_result() {} + + public withError_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withError_result(withError_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + @Override + public withError_result deepCopy() { + return new withError_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withError_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withError_result) return this.equals((withError_result) that); + return false; + } + + public boolean equals(withError_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withError_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withError_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withError_resultStandardScheme getScheme() { + return new withError_resultStandardScheme(); + } + } + + private static class withError_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withError_resultTupleScheme getScheme() { + return new withError_resultTupleScheme(); + } + } + + private static class withError_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withCollisioin_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_args"); + + private static final org.apache.thrift.protocol.TField INPUT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "input", org.apache.thrift.protocol.TType.STRING, (short) 3333); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String input; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + INPUT((short) 3333, "input"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 3333: // INPUT + return INPUT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.INPUT, + new org.apache.thrift.meta_data.FieldMetaData( + "input", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_args.class, metaDataMap); + } + + public withCollisioin_args() {} + + public withCollisioin_args(java.lang.String input) { + this(); + this.input = input; + } + + /** Performs a deep copy on other. */ + public withCollisioin_args(withCollisioin_args other) { + if (other.isSetInput()) { + this.input = other.input; + } + } + + @Override + public withCollisioin_args deepCopy() { + return new withCollisioin_args(this); + } + + @Override + public void clear() { + this.input = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getInput() { + return this.input; + } + + public withCollisioin_args setInput( + @org.apache.thrift.annotation.Nullable java.lang.String input) { + this.input = input; + return this; + } + + public void unsetInput() { + this.input = null; + } + + /** Returns true if field input is set (has been assigned a value) and false otherwise */ + public boolean isSetInput() { + return this.input != null; + } + + public void setInputIsSet(boolean value) { + if (!value) { + this.input = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case INPUT: + if (value == null) { + unsetInput(); + } else { + setInput((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case INPUT: + return getInput(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case INPUT: + return isSetInput(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withCollisioin_args) return this.equals((withCollisioin_args) that); + return false; + } + + public boolean equals(withCollisioin_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_input = true && this.isSetInput(); + boolean that_present_input = true && that.isSetInput(); + if (this_present_input || that_present_input) { + if (!(this_present_input && that_present_input)) return false; + if (!this.input.equals(that.input)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetInput()) ? 131071 : 524287); + if (isSetInput()) hashCode = hashCode * 8191 + input.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetInput(), other.isSetInput()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInput()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.input, other.input); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withCollisioin_args("); + boolean first = true; + + sb.append("input:"); + if (this.input == null) { + sb.append("null"); + } else { + sb.append(this.input); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withCollisioin_argsStandardScheme getScheme() { + return new withCollisioin_argsStandardScheme(); + } + } + + private static class withCollisioin_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 3333: // INPUT + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.input != null) { + oprot.writeFieldBegin(INPUT_FIELD_DESC); + oprot.writeString(struct.input); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withCollisioin_argsTupleScheme getScheme() { + return new withCollisioin_argsTupleScheme(); + } + } + + private static class withCollisioin_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetInput()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetInput()) { + oprot.writeString(struct.input); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withCollisioin_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_result.class, metaDataMap); + } + + public withCollisioin_result() {} + + public withCollisioin_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withCollisioin_result(withCollisioin_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + @Override + public withCollisioin_result deepCopy() { + return new withCollisioin_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withCollisioin_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withCollisioin_result) return this.equals((withCollisioin_result) that); + return false; + } + + public boolean equals(withCollisioin_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withCollisioin_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withCollisioin_resultStandardScheme getScheme() { + return new withCollisioin_resultStandardScheme(); + } + } + + private static class withCollisioin_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withCollisioin_resultTupleScheme getScheme() { + return new withCollisioin_resultTupleScheme(); + } + } + + private static class withCollisioin_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class noReturn_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_args.class, metaDataMap); + } + + public noReturn_args() {} + + public noReturn_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public noReturn_args(noReturn_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + @Override + public noReturn_args deepCopy() { + return new noReturn_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public noReturn_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof noReturn_args) return this.equals((noReturn_args) that); + return false; + } + + public boolean equals(noReturn_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(noReturn_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("noReturn_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public noReturn_argsStandardScheme getScheme() { + return new noReturn_argsStandardScheme(); + } + } + + private static class noReturn_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public noReturn_argsTupleScheme getScheme() { + return new noReturn_argsTupleScheme(); + } + } + + private static class noReturn_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class noReturn_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_result"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_resultTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_result.class, metaDataMap); + } + + public noReturn_result() {} + + /** Performs a deep copy on other. */ + public noReturn_result(noReturn_result other) {} + + @Override + public noReturn_result deepCopy() { + return new noReturn_result(this); + } + + @Override + public void clear() {} + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof noReturn_result) return this.equals((noReturn_result) that); + return false; + } + + public boolean equals(noReturn_result that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(noReturn_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("noReturn_result("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public noReturn_resultStandardScheme getScheme() { + return new noReturn_resultStandardScheme(); + } + } + + private static class noReturn_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public noReturn_resultTupleScheme getScheme() { + return new noReturn_resultTupleScheme(); + } + } + + private static class noReturn_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class oneWayHasArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayHasArgs_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayHasArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayHasArgs_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayHasArgs_args.class, metaDataMap); + } + + public oneWayHasArgs_args() {} + + public oneWayHasArgs_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public oneWayHasArgs_args(oneWayHasArgs_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + @Override + public oneWayHasArgs_args deepCopy() { + return new oneWayHasArgs_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public oneWayHasArgs_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWayHasArgs_args) return this.equals((oneWayHasArgs_args) that); + return false; + } + + public boolean equals(oneWayHasArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(oneWayHasArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWayHasArgs_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayHasArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWayHasArgs_argsStandardScheme getScheme() { + return new oneWayHasArgs_argsStandardScheme(); + } + } + + private static class oneWayHasArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayHasArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWayHasArgs_argsTupleScheme getScheme() { + return new oneWayHasArgs_argsTupleScheme(); + } + } + + private static class oneWayHasArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class oneWay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWay_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWay_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWay_args.class, metaDataMap); + } + + public oneWay_args() {} + + /** Performs a deep copy on other. */ + public oneWay_args(oneWay_args other) {} + + @Override + public oneWay_args deepCopy() { + return new oneWay_args(this); + } + + @Override + public void clear() {} + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWay_args) return this.equals((oneWay_args) that); + return false; + } + + public boolean equals(oneWay_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWay_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWay_argsStandardScheme getScheme() { + return new oneWay_argsStandardScheme(); + } + } + + private static class oneWay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWay_argsTupleScheme getScheme() { + return new oneWay_argsTupleScheme(); + } + } + + private static class oneWay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class oneWayWithError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayWithError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayWithError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayWithError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayWithError_args.class, metaDataMap); + } + + public oneWayWithError_args() {} + + /** Performs a deep copy on other. */ + public oneWayWithError_args(oneWayWithError_args other) {} + + @Override + public oneWayWithError_args deepCopy() { + return new oneWayWithError_args(this); + } + + @Override + public void clear() {} + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWayWithError_args) return this.equals((oneWayWithError_args) that); + return false; + } + + public boolean equals(oneWayWithError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWayWithError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWayWithError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayWithError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWayWithError_argsStandardScheme getScheme() { + return new oneWayWithError_argsStandardScheme(); + } + } + + private static class oneWayWithError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayWithError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWayWithError_argsTupleScheme getScheme() { + return new oneWayWithError_argsTupleScheme(); + } + } + + private static class oneWayWithError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class data_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_args"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable User user; // required + public @org.apache.thrift.annotation.Nullable Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(data_args.class, metaDataMap); + } + + public data_args() {} + + public data_args(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public data_args(data_args other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + @Override + public data_args deepCopy() { + return new data_args(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + @org.apache.thrift.annotation.Nullable + public User getUser() { + return this.user; + } + + public data_args setUser(@org.apache.thrift.annotation.Nullable User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + @org.apache.thrift.annotation.Nullable + public Account getAccount() { + return this.account; + } + + public data_args setAccount(@org.apache.thrift.annotation.Nullable Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof data_args) return this.equals((data_args) that); + return false; + } + + public boolean equals(data_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetUser(), other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAccount(), other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("data_args("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public data_argsStandardScheme getScheme() { + return new data_argsStandardScheme(); + } + } + + private static class data_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, data_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public data_argsTupleScheme getScheme() { + return new data_argsTupleScheme(); + } + } + + private static class data_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetUser()) { + optionals.set(0); + } + if (struct.isSetAccount()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetUser()) { + struct.user.write(oprot); + } + if (struct.isSetAccount()) { + struct.account.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } + if (incoming.get(1)) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class data_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRUCT, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable UserAccount success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, UserAccount.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + data_result.class, metaDataMap); + } + + public data_result() {} + + public data_result(UserAccount success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public data_result(data_result other) { + if (other.isSetSuccess()) { + this.success = new UserAccount(other.success); + } + } + + @Override + public data_result deepCopy() { + return new data_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public UserAccount getSuccess() { + return this.success; + } + + public data_result setSuccess(@org.apache.thrift.annotation.Nullable UserAccount success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((UserAccount) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof data_result) return this.equals((data_result) that); + return false; + } + + public boolean equals(data_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("data_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public data_resultStandardScheme getScheme() { + return new data_resultStandardScheme(); + } + } + + private static class data_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, data_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public data_resultTupleScheme getScheme() { + return new data_resultTupleScheme(); + } + } + + private static class data_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_17_0/User.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_17_0/User.java new file mode 100644 index 000000000000..f5d7ee91bf95 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_17_0/User.java @@ -0,0 +1,609 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_17_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.17.0)", + date = "2025-02-27") +public class User + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("User"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "userId", org.apache.thrift.protocol.TType.STRING, (short) 2); + private static final org.apache.thrift.protocol.TField AGE_FIELD_DESC = + new org.apache.thrift.protocol.TField("age", org.apache.thrift.protocol.TType.I32, (short) 3); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String name; // required + public @org.apache.thrift.annotation.Nullable java.lang.String userId; // required + public int age; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + NAME((short) 1, "name"), + USER_ID((short) 2, "userId"), + AGE((short) 3, "age"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // NAME + return NAME; + case 2: // USER_ID + return USER_ID; + case 3: // AGE + return AGE; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __AGE_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.USER_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "userId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.AGE, + new org.apache.thrift.meta_data.FieldMetaData( + "age", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(User.class, metaDataMap); + } + + public User() {} + + public User(java.lang.String name, java.lang.String userId, int age) { + this(); + this.name = name; + this.userId = userId; + this.age = age; + setAgeIsSet(true); + } + + /** Performs a deep copy on other. */ + public User(User other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetName()) { + this.name = other.name; + } + if (other.isSetUserId()) { + this.userId = other.userId; + } + this.age = other.age; + } + + @Override + public User deepCopy() { + return new User(this); + } + + @Override + public void clear() { + this.name = null; + this.userId = null; + setAgeIsSet(false); + this.age = 0; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getName() { + return this.name; + } + + public User setName(@org.apache.thrift.annotation.Nullable java.lang.String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getUserId() { + return this.userId; + } + + public User setUserId(@org.apache.thrift.annotation.Nullable java.lang.String userId) { + this.userId = userId; + return this; + } + + public void unsetUserId() { + this.userId = null; + } + + /** Returns true if field userId is set (has been assigned a value) and false otherwise */ + public boolean isSetUserId() { + return this.userId != null; + } + + public void setUserIdIsSet(boolean value) { + if (!value) { + this.userId = null; + } + } + + public int getAge() { + return this.age; + } + + public User setAge(int age) { + this.age = age; + setAgeIsSet(true); + return this; + } + + public void unsetAge() { + __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __AGE_ISSET_ID); + } + + /** Returns true if field age is set (has been assigned a value) and false otherwise */ + public boolean isSetAge() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __AGE_ISSET_ID); + } + + public void setAgeIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __AGE_ISSET_ID, value); + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case NAME: + if (value == null) { + unsetName(); + } else { + setName((java.lang.String) value); + } + break; + + case USER_ID: + if (value == null) { + unsetUserId(); + } else { + setUserId((java.lang.String) value); + } + break; + + case AGE: + if (value == null) { + unsetAge(); + } else { + setAge((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case NAME: + return getName(); + + case USER_ID: + return getUserId(); + + case AGE: + return getAge(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case NAME: + return isSetName(); + case USER_ID: + return isSetUserId(); + case AGE: + return isSetAge(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof User) return this.equals((User) that); + return false; + } + + public boolean equals(User that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + boolean this_present_userId = true && this.isSetUserId(); + boolean that_present_userId = true && that.isSetUserId(); + if (this_present_userId || that_present_userId) { + if (!(this_present_userId && that_present_userId)) return false; + if (!this.userId.equals(that.userId)) return false; + } + + boolean this_present_age = true; + boolean that_present_age = true; + if (this_present_age || that_present_age) { + if (!(this_present_age && that_present_age)) return false; + if (this.age != that.age) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + hashCode = hashCode * 8191 + ((isSetUserId()) ? 131071 : 524287); + if (isSetUserId()) hashCode = hashCode * 8191 + userId.hashCode(); + + hashCode = hashCode * 8191 + age; + + return hashCode; + } + + @Override + public int compareTo(User other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetName(), other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetUserId(), other.isSetUserId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAge(), other.isSetAge()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAge()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.age, other.age); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("User("); + boolean first = true; + + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + if (!first) sb.append(", "); + sb.append("userId:"); + if (this.userId == null) { + sb.append("null"); + } else { + sb.append(this.userId); + } + first = false; + if (!first) sb.append(", "); + sb.append("age:"); + sb.append(this.age); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (name == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'name' was not present! Struct: " + toString()); + } + if (userId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'userId' was not present! Struct: " + toString()); + } + // alas, we cannot check 'age' because it's a primitive and you chose the non-beans generator. + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + @Override + public UserStandardScheme getScheme() { + return new UserStandardScheme(); + } + } + + private static class UserStandardScheme extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // AGE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + if (!struct.isSetAge()) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'age' was not found in serialized data! Struct: " + toString()); + } + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, User struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + if (struct.userId != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userId); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(AGE_FIELD_DESC); + oprot.writeI32(struct.age); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + @Override + public UserTupleScheme getScheme() { + return new UserTupleScheme(); + } + } + + private static class UserTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.name); + oprot.writeString(struct.userId); + oprot.writeI32(struct.age); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.name = iprot.readString(); + struct.setNameIsSet(true); + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_17_0/UserAccount.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_17_0/UserAccount.java new file mode 100644 index 000000000000..34379dcb8e09 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_17_0/UserAccount.java @@ -0,0 +1,520 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_17_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.17.0)", + date = "2025-02-27") +public class UserAccount + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("UserAccount"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserAccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserAccountTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable User user; // required + public @org.apache.thrift.annotation.Nullable Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserAccount.class, metaDataMap); + } + + public UserAccount() {} + + public UserAccount(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public UserAccount(UserAccount other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + @Override + public UserAccount deepCopy() { + return new UserAccount(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + @org.apache.thrift.annotation.Nullable + public User getUser() { + return this.user; + } + + public UserAccount setUser(@org.apache.thrift.annotation.Nullable User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + @org.apache.thrift.annotation.Nullable + public Account getAccount() { + return this.account; + } + + public UserAccount setAccount(@org.apache.thrift.annotation.Nullable Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof UserAccount) return this.equals((UserAccount) that); + return false; + } + + public boolean equals(UserAccount that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(UserAccount other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetUser(), other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAccount(), other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("UserAccount("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (user == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'user' was not present! Struct: " + toString()); + } + if (account == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'account' was not present! Struct: " + toString()); + } + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserAccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public UserAccountStandardScheme getScheme() { + return new UserAccountStandardScheme(); + } + } + + private static class UserAccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, UserAccount struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserAccountTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public UserAccountTupleScheme getScheme() { + return new UserAccountTupleScheme(); + } + } + + private static class UserAccountTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user.write(oprot); + struct.account.write(oprot); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_18_0/Account.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_18_0/Account.java new file mode 100644 index 000000000000..67a4bf5a180a --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_18_0/Account.java @@ -0,0 +1,508 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_18_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.18.0)", + date = "2025-02-27") +public class Account + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("Account"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField CARD_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "cardId", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new AccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new AccountTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String zone; // required + public @org.apache.thrift.annotation.Nullable java.lang.String cardId; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + CARD_ID((short) 2, "cardId"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // CARD_ID + return CARD_ID; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.CARD_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "cardId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Account.class, metaDataMap); + } + + public Account() {} + + public Account(java.lang.String zone, java.lang.String cardId) { + this(); + this.zone = zone; + this.cardId = cardId; + } + + /** Performs a deep copy on other. */ + public Account(Account other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetCardId()) { + this.cardId = other.cardId; + } + } + + @Override + public Account deepCopy() { + return new Account(this); + } + + @Override + public void clear() { + this.zone = null; + this.cardId = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getZone() { + return this.zone; + } + + public Account setZone(@org.apache.thrift.annotation.Nullable java.lang.String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getCardId() { + return this.cardId; + } + + public Account setCardId(@org.apache.thrift.annotation.Nullable java.lang.String cardId) { + this.cardId = cardId; + return this; + } + + public void unsetCardId() { + this.cardId = null; + } + + /** Returns true if field cardId is set (has been assigned a value) and false otherwise */ + public boolean isSetCardId() { + return this.cardId != null; + } + + public void setCardIdIsSet(boolean value) { + if (!value) { + this.cardId = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((java.lang.String) value); + } + break; + + case CARD_ID: + if (value == null) { + unsetCardId(); + } else { + setCardId((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case CARD_ID: + return getCardId(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case CARD_ID: + return isSetCardId(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof Account) return this.equals((Account) that); + return false; + } + + public boolean equals(Account that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_cardId = true && this.isSetCardId(); + boolean that_present_cardId = true && that.isSetCardId(); + if (this_present_cardId || that_present_cardId) { + if (!(this_present_cardId && that_present_cardId)) return false; + if (!this.cardId.equals(that.cardId)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetCardId()) ? 131071 : 524287); + if (isSetCardId()) hashCode = hashCode * 8191 + cardId.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(Account other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetZone(), other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetCardId(), other.isSetCardId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCardId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cardId, other.cardId); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("Account("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("cardId:"); + if (this.cardId == null) { + sb.append("null"); + } else { + sb.append(this.cardId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (zone == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'zone' was not present! Struct: " + toString()); + } + if (cardId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'cardId' was not present! Struct: " + toString()); + } + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class AccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public AccountStandardScheme getScheme() { + return new AccountStandardScheme(); + } + } + + private static class AccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // CARD_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, Account struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.cardId != null) { + oprot.writeFieldBegin(CARD_ID_FIELD_DESC); + oprot.writeString(struct.cardId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class AccountTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + @Override + public AccountTupleScheme getScheme() { + return new AccountTupleScheme(); + } + } + + private static class AccountTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.zone); + oprot.writeString(struct.cardId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_18_0/ThriftService.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_18_0/ThriftService.java new file mode 100644 index 000000000000..8a9779f1af72 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_18_0/ThriftService.java @@ -0,0 +1,8475 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_18_0; + +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.18.0)", + date = "2025-02-27") +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +public class ThriftService { + + public interface Iface { + + public java.lang.String sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException; + + public java.lang.String withDelay(int delay) throws org.apache.thrift.TException; + + public java.lang.String withoutArgs() throws org.apache.thrift.TException; + + public java.lang.String withError() throws org.apache.thrift.TException; + + public java.lang.String withCollisioin(java.lang.String input) + throws org.apache.thrift.TException; + + public void noReturn(int delay) throws org.apache.thrift.TException; + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException; + + public void oneWay() throws org.apache.thrift.TException; + + public void oneWayWithError() throws org.apache.thrift.TException; + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException; + } + + public interface AsyncIface { + + public void sayHello( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withCollisioin( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + } + + public static class Client extends org.apache.thrift.TServiceClient implements Iface { + public static class Factory implements org.apache.thrift.TServiceClientFactory { + public Factory() {} + + @Override + public Client getClient(org.apache.thrift.protocol.TProtocol prot) { + return new Client(prot); + } + + @Override + public Client getClient( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + return new Client(iprot, oprot); + } + } + + public Client(org.apache.thrift.protocol.TProtocol prot) { + super(prot, prot); + } + + public Client( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + super(iprot, oprot); + } + + @Override + public java.lang.String sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException { + send_sayHello(zone, name); + return recv_sayHello(); + } + + public void send_sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException { + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + sendBase("sayHello", args); + } + + public java.lang.String recv_sayHello() throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + receiveBase(result, "sayHello"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "sayHello failed: unknown result"); + } + + @Override + public java.lang.String withDelay(int delay) throws org.apache.thrift.TException { + send_withDelay(delay); + return recv_withDelay(); + } + + public void send_withDelay(int delay) throws org.apache.thrift.TException { + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + sendBase("withDelay", args); + } + + public java.lang.String recv_withDelay() throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + receiveBase(result, "withDelay"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withDelay failed: unknown result"); + } + + @Override + public java.lang.String withoutArgs() throws org.apache.thrift.TException { + send_withoutArgs(); + return recv_withoutArgs(); + } + + public void send_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_args args = new withoutArgs_args(); + sendBase("withoutArgs", args); + } + + public java.lang.String recv_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + receiveBase(result, "withoutArgs"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withoutArgs failed: unknown result"); + } + + @Override + public java.lang.String withError() throws org.apache.thrift.TException { + send_withError(); + return recv_withError(); + } + + public void send_withError() throws org.apache.thrift.TException { + withError_args args = new withError_args(); + sendBase("withError", args); + } + + public java.lang.String recv_withError() throws org.apache.thrift.TException { + withError_result result = new withError_result(); + receiveBase(result, "withError"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withError failed: unknown result"); + } + + @Override + public java.lang.String withCollisioin(java.lang.String input) + throws org.apache.thrift.TException { + send_withCollisioin(input); + return recv_withCollisioin(); + } + + public void send_withCollisioin(java.lang.String input) throws org.apache.thrift.TException { + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + sendBase("withCollisioin", args); + } + + public java.lang.String recv_withCollisioin() throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + receiveBase(result, "withCollisioin"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withCollisioin failed: unknown result"); + } + + @Override + public void noReturn(int delay) throws org.apache.thrift.TException { + send_noReturn(delay); + recv_noReturn(); + } + + public void send_noReturn(int delay) throws org.apache.thrift.TException { + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + sendBase("noReturn", args); + } + + public void recv_noReturn() throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + receiveBase(result, "noReturn"); + return; + } + + @Override + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException { + send_oneWayHasArgs(delay); + } + + public void send_oneWayHasArgs(int delay) throws org.apache.thrift.TException { + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + sendBaseOneway("oneWayHasArgs", args); + } + + @Override + public void oneWay() throws org.apache.thrift.TException { + send_oneWay(); + } + + public void send_oneWay() throws org.apache.thrift.TException { + oneWay_args args = new oneWay_args(); + sendBaseOneway("oneWay", args); + } + + @Override + public void oneWayWithError() throws org.apache.thrift.TException { + send_oneWayWithError(); + } + + public void send_oneWayWithError() throws org.apache.thrift.TException { + oneWayWithError_args args = new oneWayWithError_args(); + sendBaseOneway("oneWayWithError", args); + } + + @Override + public UserAccount data(User user, Account account) throws org.apache.thrift.TException { + send_data(user, account); + return recv_data(); + } + + public void send_data(User user, Account account) throws org.apache.thrift.TException { + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + sendBase("data", args); + } + + public UserAccount recv_data() throws org.apache.thrift.TException { + data_result result = new data_result(); + receiveBase(result, "data"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, "data failed: unknown result"); + } + } + + public static class AsyncClient extends org.apache.thrift.async.TAsyncClient + implements AsyncIface { + public static class Factory + implements org.apache.thrift.async.TAsyncClientFactory { + private org.apache.thrift.async.TAsyncClientManager clientManager; + private org.apache.thrift.protocol.TProtocolFactory protocolFactory; + + public Factory( + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.protocol.TProtocolFactory protocolFactory) { + this.clientManager = clientManager; + this.protocolFactory = protocolFactory; + } + + @Override + public AsyncClient getAsyncClient( + org.apache.thrift.transport.TNonblockingTransport transport) { + return new AsyncClient(protocolFactory, clientManager, transport); + } + } + + public AsyncClient( + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.transport.TNonblockingTransport transport) { + super(protocolFactory, clientManager, transport); + } + + @Override + public void sayHello( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + sayHello_call method_call = + new sayHello_call(zone, name, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class sayHello_call + extends org.apache.thrift.async.TAsyncMethodCall { + private java.lang.String zone; + private java.lang.String name; + + public sayHello_call( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.zone = zone; + this.name = name; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "sayHello", org.apache.thrift.protocol.TMessageType.CALL, 0)); + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_sayHello(); + } + } + + @Override + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withDelay_call method_call = + new withDelay_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withDelay_call + extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public withDelay_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withDelay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withDelay(); + } + } + + @Override + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withoutArgs_call method_call = + new withoutArgs_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withoutArgs_call + extends org.apache.thrift.async.TAsyncMethodCall { + public withoutArgs_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withoutArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withoutArgs_args args = new withoutArgs_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withoutArgs(); + } + } + + @Override + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withError_call method_call = + new withError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withError_call + extends org.apache.thrift.async.TAsyncMethodCall { + public withError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withError_args args = new withError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withError(); + } + } + + @Override + public void withCollisioin( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withCollisioin_call method_call = + new withCollisioin_call(input, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withCollisioin_call + extends org.apache.thrift.async.TAsyncMethodCall { + private java.lang.String input; + + public withCollisioin_call( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.input = input; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withCollisioin", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withCollisioin(); + } + } + + @Override + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + noReturn_call method_call = + new noReturn_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class noReturn_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public noReturn_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "noReturn", org.apache.thrift.protocol.TMessageType.CALL, 0)); + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + (new Client(prot)).recv_noReturn(); + return null; + } + } + + @Override + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayHasArgs_call method_call = + new oneWayHasArgs_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayHasArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public oneWayHasArgs_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + this.delay = delay; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayHasArgs", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + @Override + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWay_call method_call = + new oneWay_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWay_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWay_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWay", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWay_args args = new oneWay_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + @Override + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayWithError_call method_call = + new oneWayWithError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayWithError_call + extends org.apache.thrift.async.TAsyncMethodCall { + public oneWayWithError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayWithError", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayWithError_args args = new oneWayWithError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + @Override + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + data_call method_call = + new data_call(user, account, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class data_call extends org.apache.thrift.async.TAsyncMethodCall { + private User user; + private Account account; + + public data_call( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.user = user; + this.account = account; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "data", org.apache.thrift.protocol.TMessageType.CALL, 0)); + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public UserAccount getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_data(); + } + } + } + + public static class Processor extends org.apache.thrift.TBaseProcessor + implements org.apache.thrift.TProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(Processor.class.getName()); + + public Processor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + java.lang.String, + org.apache.thrift.ProcessFunction>())); + } + + protected Processor( + I iface, + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + getProcessMap( + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.ProcessFunction { + public sayHello() { + super("sayHello"); + } + + @Override + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public sayHello_result getResult(I iface, sayHello_args args) + throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + result.success = iface.sayHello(args.zone, args.name); + return result; + } + } + + public static class withDelay + extends org.apache.thrift.ProcessFunction { + public withDelay() { + super("withDelay"); + } + + @Override + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public withDelay_result getResult(I iface, withDelay_args args) + throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + result.success = iface.withDelay(args.delay); + return result; + } + } + + public static class withoutArgs + extends org.apache.thrift.ProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + @Override + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public withoutArgs_result getResult(I iface, withoutArgs_args args) + throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + result.success = iface.withoutArgs(); + return result; + } + } + + public static class withError + extends org.apache.thrift.ProcessFunction { + public withError() { + super("withError"); + } + + @Override + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public withError_result getResult(I iface, withError_args args) + throws org.apache.thrift.TException { + withError_result result = new withError_result(); + result.success = iface.withError(); + return result; + } + } + + public static class withCollisioin + extends org.apache.thrift.ProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + @Override + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public withCollisioin_result getResult(I iface, withCollisioin_args args) + throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + result.success = iface.withCollisioin(args.input); + return result; + } + } + + public static class noReturn + extends org.apache.thrift.ProcessFunction { + public noReturn() { + super("noReturn"); + } + + @Override + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public noReturn_result getResult(I iface, noReturn_args args) + throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + iface.noReturn(args.delay); + return result; + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.ProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + @Override + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + @Override + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public org.apache.thrift.TBase getResult(I iface, oneWayHasArgs_args args) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay); + return null; + } + } + + public static class oneWay + extends org.apache.thrift.ProcessFunction { + public oneWay() { + super("oneWay"); + } + + @Override + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + @Override + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public org.apache.thrift.TBase getResult(I iface, oneWay_args args) + throws org.apache.thrift.TException { + iface.oneWay(); + return null; + } + } + + public static class oneWayWithError + extends org.apache.thrift.ProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + @Override + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + @Override + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public org.apache.thrift.TBase getResult(I iface, oneWayWithError_args args) + throws org.apache.thrift.TException { + iface.oneWayWithError(); + return null; + } + } + + public static class data + extends org.apache.thrift.ProcessFunction { + public data() { + super("data"); + } + + @Override + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public data_result getResult(I iface, data_args args) throws org.apache.thrift.TException { + data_result result = new data_result(); + result.success = iface.data(args.user, args.account); + return result; + } + } + } + + public static class AsyncProcessor + extends org.apache.thrift.TBaseAsyncProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(AsyncProcessor.class.getName()); + + public AsyncProcessor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>>())); + } + + protected AsyncProcessor( + I iface, + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction> + getProcessMap( + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.AsyncProcessFunction { + public sayHello() { + super("sayHello"); + } + + @Override + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(java.lang.String o) { + sayHello_result result = new sayHello_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + sayHello_result result = new sayHello_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + sayHello_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.sayHello(args.zone, args.name, resultHandler); + } + } + + public static class withDelay + extends org.apache.thrift.AsyncProcessFunction { + public withDelay() { + super("withDelay"); + } + + @Override + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(java.lang.String o) { + withDelay_result result = new withDelay_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withDelay_result result = new withDelay_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + withDelay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withDelay(args.delay, resultHandler); + } + } + + public static class withoutArgs + extends org.apache.thrift.AsyncProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + @Override + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(java.lang.String o) { + withoutArgs_result result = new withoutArgs_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withoutArgs_result result = new withoutArgs_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + withoutArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withoutArgs(resultHandler); + } + } + + public static class withError + extends org.apache.thrift.AsyncProcessFunction { + public withError() { + super("withError"); + } + + @Override + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(java.lang.String o) { + withError_result result = new withError_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withError_result result = new withError_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + withError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withError(resultHandler); + } + } + + public static class withCollisioin + extends org.apache.thrift.AsyncProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + @Override + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(java.lang.String o) { + withCollisioin_result result = new withCollisioin_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withCollisioin_result result = new withCollisioin_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + withCollisioin_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withCollisioin(args.input, resultHandler); + } + } + + public static class noReturn + extends org.apache.thrift.AsyncProcessFunction { + public noReturn() { + super("noReturn"); + } + + @Override + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(Void o) { + noReturn_result result = new noReturn_result(); + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + noReturn_result result = new noReturn_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + noReturn_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.noReturn(args.delay, resultHandler); + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.AsyncProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + @Override + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(Void o) {} + + @Override + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + @Override + protected boolean isOneway() { + return true; + } + + @Override + public void start( + I iface, + oneWayHasArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay, resultHandler); + } + } + + public static class oneWay + extends org.apache.thrift.AsyncProcessFunction { + public oneWay() { + super("oneWay"); + } + + @Override + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(Void o) {} + + @Override + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + @Override + protected boolean isOneway() { + return true; + } + + @Override + public void start( + I iface, + oneWay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWay(resultHandler); + } + } + + public static class oneWayWithError + extends org.apache.thrift.AsyncProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + @Override + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(Void o) {} + + @Override + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + @Override + protected boolean isOneway() { + return true; + } + + @Override + public void start( + I iface, + oneWayWithError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayWithError(resultHandler); + } + } + + public static class data + extends org.apache.thrift.AsyncProcessFunction { + public data() { + super("data"); + } + + @Override + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(UserAccount o) { + data_result result = new data_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + data_result result = new data_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + data_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.data(args.user, args.account, resultHandler); + } + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class sayHello_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_args"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String zone; // required + public @org.apache.thrift.annotation.Nullable java.lang.String name; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + NAME((short) 2, "name"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // NAME + return NAME; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_args.class, metaDataMap); + } + + public sayHello_args() {} + + public sayHello_args(java.lang.String zone, java.lang.String name) { + this(); + this.zone = zone; + this.name = name; + } + + /** Performs a deep copy on other. */ + public sayHello_args(sayHello_args other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetName()) { + this.name = other.name; + } + } + + @Override + public sayHello_args deepCopy() { + return new sayHello_args(this); + } + + @Override + public void clear() { + this.zone = null; + this.name = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getZone() { + return this.zone; + } + + public sayHello_args setZone(@org.apache.thrift.annotation.Nullable java.lang.String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getName() { + return this.name; + } + + public sayHello_args setName(@org.apache.thrift.annotation.Nullable java.lang.String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((java.lang.String) value); + } + break; + + case NAME: + if (value == null) { + unsetName(); + } else { + setName((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case NAME: + return getName(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case NAME: + return isSetName(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof sayHello_args) return this.equals((sayHello_args) that); + return false; + } + + public boolean equals(sayHello_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetZone(), other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetName(), other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("sayHello_args("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public sayHello_argsStandardScheme getScheme() { + return new sayHello_argsStandardScheme(); + } + } + + private static class sayHello_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public sayHello_argsTupleScheme getScheme() { + return new sayHello_argsTupleScheme(); + } + } + + private static class sayHello_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetZone()) { + optionals.set(0); + } + if (struct.isSetName()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetZone()) { + oprot.writeString(struct.zone); + } + if (struct.isSetName()) { + oprot.writeString(struct.name); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } + if (incoming.get(1)) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class sayHello_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_result.class, metaDataMap); + } + + public sayHello_result() {} + + public sayHello_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public sayHello_result(sayHello_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + @Override + public sayHello_result deepCopy() { + return new sayHello_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public sayHello_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof sayHello_result) return this.equals((sayHello_result) that); + return false; + } + + public boolean equals(sayHello_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("sayHello_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public sayHello_resultStandardScheme getScheme() { + return new sayHello_resultStandardScheme(); + } + } + + private static class sayHello_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public sayHello_resultTupleScheme getScheme() { + return new sayHello_resultTupleScheme(); + } + } + + private static class sayHello_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withDelay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_args.class, metaDataMap); + } + + public withDelay_args() {} + + public withDelay_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public withDelay_args(withDelay_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + @Override + public withDelay_args deepCopy() { + return new withDelay_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public withDelay_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withDelay_args) return this.equals((withDelay_args) that); + return false; + } + + public boolean equals(withDelay_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(withDelay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withDelay_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withDelay_argsStandardScheme getScheme() { + return new withDelay_argsStandardScheme(); + } + } + + private static class withDelay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withDelay_argsTupleScheme getScheme() { + return new withDelay_argsTupleScheme(); + } + } + + private static class withDelay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withDelay_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_result.class, metaDataMap); + } + + public withDelay_result() {} + + public withDelay_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withDelay_result(withDelay_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + @Override + public withDelay_result deepCopy() { + return new withDelay_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withDelay_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withDelay_result) return this.equals((withDelay_result) that); + return false; + } + + public boolean equals(withDelay_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withDelay_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withDelay_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withDelay_resultStandardScheme getScheme() { + return new withDelay_resultStandardScheme(); + } + } + + private static class withDelay_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withDelay_resultTupleScheme getScheme() { + return new withDelay_resultTupleScheme(); + } + } + + private static class withDelay_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withoutArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_args.class, metaDataMap); + } + + public withoutArgs_args() {} + + /** Performs a deep copy on other. */ + public withoutArgs_args(withoutArgs_args other) {} + + @Override + public withoutArgs_args deepCopy() { + return new withoutArgs_args(this); + } + + @Override + public void clear() {} + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withoutArgs_args) return this.equals((withoutArgs_args) that); + return false; + } + + public boolean equals(withoutArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withoutArgs_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withoutArgs_argsStandardScheme getScheme() { + return new withoutArgs_argsStandardScheme(); + } + } + + private static class withoutArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withoutArgs_argsTupleScheme getScheme() { + return new withoutArgs_argsTupleScheme(); + } + } + + private static class withoutArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withoutArgs_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_result.class, metaDataMap); + } + + public withoutArgs_result() {} + + public withoutArgs_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withoutArgs_result(withoutArgs_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + @Override + public withoutArgs_result deepCopy() { + return new withoutArgs_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withoutArgs_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withoutArgs_result) return this.equals((withoutArgs_result) that); + return false; + } + + public boolean equals(withoutArgs_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withoutArgs_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withoutArgs_resultStandardScheme getScheme() { + return new withoutArgs_resultStandardScheme(); + } + } + + private static class withoutArgs_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withoutArgs_resultTupleScheme getScheme() { + return new withoutArgs_resultTupleScheme(); + } + } + + private static class withoutArgs_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_args.class, metaDataMap); + } + + public withError_args() {} + + /** Performs a deep copy on other. */ + public withError_args(withError_args other) {} + + @Override + public withError_args deepCopy() { + return new withError_args(this); + } + + @Override + public void clear() {} + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withError_args) return this.equals((withError_args) that); + return false; + } + + public boolean equals(withError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withError_argsStandardScheme getScheme() { + return new withError_argsStandardScheme(); + } + } + + private static class withError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withError_argsTupleScheme getScheme() { + return new withError_argsTupleScheme(); + } + } + + private static class withError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withError_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_result.class, metaDataMap); + } + + public withError_result() {} + + public withError_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withError_result(withError_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + @Override + public withError_result deepCopy() { + return new withError_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withError_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withError_result) return this.equals((withError_result) that); + return false; + } + + public boolean equals(withError_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withError_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withError_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withError_resultStandardScheme getScheme() { + return new withError_resultStandardScheme(); + } + } + + private static class withError_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withError_resultTupleScheme getScheme() { + return new withError_resultTupleScheme(); + } + } + + private static class withError_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withCollisioin_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_args"); + + private static final org.apache.thrift.protocol.TField INPUT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "input", org.apache.thrift.protocol.TType.STRING, (short) 3333); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String input; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + INPUT((short) 3333, "input"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 3333: // INPUT + return INPUT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.INPUT, + new org.apache.thrift.meta_data.FieldMetaData( + "input", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_args.class, metaDataMap); + } + + public withCollisioin_args() {} + + public withCollisioin_args(java.lang.String input) { + this(); + this.input = input; + } + + /** Performs a deep copy on other. */ + public withCollisioin_args(withCollisioin_args other) { + if (other.isSetInput()) { + this.input = other.input; + } + } + + @Override + public withCollisioin_args deepCopy() { + return new withCollisioin_args(this); + } + + @Override + public void clear() { + this.input = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getInput() { + return this.input; + } + + public withCollisioin_args setInput( + @org.apache.thrift.annotation.Nullable java.lang.String input) { + this.input = input; + return this; + } + + public void unsetInput() { + this.input = null; + } + + /** Returns true if field input is set (has been assigned a value) and false otherwise */ + public boolean isSetInput() { + return this.input != null; + } + + public void setInputIsSet(boolean value) { + if (!value) { + this.input = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case INPUT: + if (value == null) { + unsetInput(); + } else { + setInput((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case INPUT: + return getInput(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case INPUT: + return isSetInput(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withCollisioin_args) return this.equals((withCollisioin_args) that); + return false; + } + + public boolean equals(withCollisioin_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_input = true && this.isSetInput(); + boolean that_present_input = true && that.isSetInput(); + if (this_present_input || that_present_input) { + if (!(this_present_input && that_present_input)) return false; + if (!this.input.equals(that.input)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetInput()) ? 131071 : 524287); + if (isSetInput()) hashCode = hashCode * 8191 + input.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetInput(), other.isSetInput()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInput()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.input, other.input); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withCollisioin_args("); + boolean first = true; + + sb.append("input:"); + if (this.input == null) { + sb.append("null"); + } else { + sb.append(this.input); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withCollisioin_argsStandardScheme getScheme() { + return new withCollisioin_argsStandardScheme(); + } + } + + private static class withCollisioin_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 3333: // INPUT + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.input != null) { + oprot.writeFieldBegin(INPUT_FIELD_DESC); + oprot.writeString(struct.input); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withCollisioin_argsTupleScheme getScheme() { + return new withCollisioin_argsTupleScheme(); + } + } + + private static class withCollisioin_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetInput()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetInput()) { + oprot.writeString(struct.input); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withCollisioin_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_result.class, metaDataMap); + } + + public withCollisioin_result() {} + + public withCollisioin_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withCollisioin_result(withCollisioin_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + @Override + public withCollisioin_result deepCopy() { + return new withCollisioin_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withCollisioin_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withCollisioin_result) return this.equals((withCollisioin_result) that); + return false; + } + + public boolean equals(withCollisioin_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withCollisioin_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withCollisioin_resultStandardScheme getScheme() { + return new withCollisioin_resultStandardScheme(); + } + } + + private static class withCollisioin_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withCollisioin_resultTupleScheme getScheme() { + return new withCollisioin_resultTupleScheme(); + } + } + + private static class withCollisioin_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class noReturn_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_args.class, metaDataMap); + } + + public noReturn_args() {} + + public noReturn_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public noReturn_args(noReturn_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + @Override + public noReturn_args deepCopy() { + return new noReturn_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public noReturn_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof noReturn_args) return this.equals((noReturn_args) that); + return false; + } + + public boolean equals(noReturn_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(noReturn_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("noReturn_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public noReturn_argsStandardScheme getScheme() { + return new noReturn_argsStandardScheme(); + } + } + + private static class noReturn_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public noReturn_argsTupleScheme getScheme() { + return new noReturn_argsTupleScheme(); + } + } + + private static class noReturn_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class noReturn_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_result"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_resultTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_result.class, metaDataMap); + } + + public noReturn_result() {} + + /** Performs a deep copy on other. */ + public noReturn_result(noReturn_result other) {} + + @Override + public noReturn_result deepCopy() { + return new noReturn_result(this); + } + + @Override + public void clear() {} + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof noReturn_result) return this.equals((noReturn_result) that); + return false; + } + + public boolean equals(noReturn_result that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(noReturn_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("noReturn_result("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public noReturn_resultStandardScheme getScheme() { + return new noReturn_resultStandardScheme(); + } + } + + private static class noReturn_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public noReturn_resultTupleScheme getScheme() { + return new noReturn_resultTupleScheme(); + } + } + + private static class noReturn_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class oneWayHasArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayHasArgs_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayHasArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayHasArgs_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayHasArgs_args.class, metaDataMap); + } + + public oneWayHasArgs_args() {} + + public oneWayHasArgs_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public oneWayHasArgs_args(oneWayHasArgs_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + @Override + public oneWayHasArgs_args deepCopy() { + return new oneWayHasArgs_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public oneWayHasArgs_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWayHasArgs_args) return this.equals((oneWayHasArgs_args) that); + return false; + } + + public boolean equals(oneWayHasArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(oneWayHasArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWayHasArgs_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayHasArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWayHasArgs_argsStandardScheme getScheme() { + return new oneWayHasArgs_argsStandardScheme(); + } + } + + private static class oneWayHasArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayHasArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWayHasArgs_argsTupleScheme getScheme() { + return new oneWayHasArgs_argsTupleScheme(); + } + } + + private static class oneWayHasArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class oneWay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWay_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWay_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWay_args.class, metaDataMap); + } + + public oneWay_args() {} + + /** Performs a deep copy on other. */ + public oneWay_args(oneWay_args other) {} + + @Override + public oneWay_args deepCopy() { + return new oneWay_args(this); + } + + @Override + public void clear() {} + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWay_args) return this.equals((oneWay_args) that); + return false; + } + + public boolean equals(oneWay_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWay_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWay_argsStandardScheme getScheme() { + return new oneWay_argsStandardScheme(); + } + } + + private static class oneWay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWay_argsTupleScheme getScheme() { + return new oneWay_argsTupleScheme(); + } + } + + private static class oneWay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class oneWayWithError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayWithError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayWithError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayWithError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayWithError_args.class, metaDataMap); + } + + public oneWayWithError_args() {} + + /** Performs a deep copy on other. */ + public oneWayWithError_args(oneWayWithError_args other) {} + + @Override + public oneWayWithError_args deepCopy() { + return new oneWayWithError_args(this); + } + + @Override + public void clear() {} + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWayWithError_args) return this.equals((oneWayWithError_args) that); + return false; + } + + public boolean equals(oneWayWithError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWayWithError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWayWithError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayWithError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWayWithError_argsStandardScheme getScheme() { + return new oneWayWithError_argsStandardScheme(); + } + } + + private static class oneWayWithError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayWithError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWayWithError_argsTupleScheme getScheme() { + return new oneWayWithError_argsTupleScheme(); + } + } + + private static class oneWayWithError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class data_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_args"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable User user; // required + public @org.apache.thrift.annotation.Nullable Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(data_args.class, metaDataMap); + } + + public data_args() {} + + public data_args(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public data_args(data_args other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + @Override + public data_args deepCopy() { + return new data_args(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + @org.apache.thrift.annotation.Nullable + public User getUser() { + return this.user; + } + + public data_args setUser(@org.apache.thrift.annotation.Nullable User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + @org.apache.thrift.annotation.Nullable + public Account getAccount() { + return this.account; + } + + public data_args setAccount(@org.apache.thrift.annotation.Nullable Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof data_args) return this.equals((data_args) that); + return false; + } + + public boolean equals(data_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetUser(), other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAccount(), other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("data_args("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public data_argsStandardScheme getScheme() { + return new data_argsStandardScheme(); + } + } + + private static class data_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, data_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public data_argsTupleScheme getScheme() { + return new data_argsTupleScheme(); + } + } + + private static class data_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetUser()) { + optionals.set(0); + } + if (struct.isSetAccount()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetUser()) { + struct.user.write(oprot); + } + if (struct.isSetAccount()) { + struct.account.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } + if (incoming.get(1)) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class data_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRUCT, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable UserAccount success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, UserAccount.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + data_result.class, metaDataMap); + } + + public data_result() {} + + public data_result(UserAccount success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public data_result(data_result other) { + if (other.isSetSuccess()) { + this.success = new UserAccount(other.success); + } + } + + @Override + public data_result deepCopy() { + return new data_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public UserAccount getSuccess() { + return this.success; + } + + public data_result setSuccess(@org.apache.thrift.annotation.Nullable UserAccount success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((UserAccount) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof data_result) return this.equals((data_result) that); + return false; + } + + public boolean equals(data_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("data_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public data_resultStandardScheme getScheme() { + return new data_resultStandardScheme(); + } + } + + private static class data_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, data_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public data_resultTupleScheme getScheme() { + return new data_resultTupleScheme(); + } + } + + private static class data_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_18_0/User.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_18_0/User.java new file mode 100644 index 000000000000..05b30efb2251 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_18_0/User.java @@ -0,0 +1,609 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_18_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.18.0)", + date = "2025-02-27") +public class User + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("User"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "userId", org.apache.thrift.protocol.TType.STRING, (short) 2); + private static final org.apache.thrift.protocol.TField AGE_FIELD_DESC = + new org.apache.thrift.protocol.TField("age", org.apache.thrift.protocol.TType.I32, (short) 3); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String name; // required + public @org.apache.thrift.annotation.Nullable java.lang.String userId; // required + public int age; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + NAME((short) 1, "name"), + USER_ID((short) 2, "userId"), + AGE((short) 3, "age"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // NAME + return NAME; + case 2: // USER_ID + return USER_ID; + case 3: // AGE + return AGE; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __AGE_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.USER_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "userId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.AGE, + new org.apache.thrift.meta_data.FieldMetaData( + "age", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(User.class, metaDataMap); + } + + public User() {} + + public User(java.lang.String name, java.lang.String userId, int age) { + this(); + this.name = name; + this.userId = userId; + this.age = age; + setAgeIsSet(true); + } + + /** Performs a deep copy on other. */ + public User(User other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetName()) { + this.name = other.name; + } + if (other.isSetUserId()) { + this.userId = other.userId; + } + this.age = other.age; + } + + @Override + public User deepCopy() { + return new User(this); + } + + @Override + public void clear() { + this.name = null; + this.userId = null; + setAgeIsSet(false); + this.age = 0; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getName() { + return this.name; + } + + public User setName(@org.apache.thrift.annotation.Nullable java.lang.String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getUserId() { + return this.userId; + } + + public User setUserId(@org.apache.thrift.annotation.Nullable java.lang.String userId) { + this.userId = userId; + return this; + } + + public void unsetUserId() { + this.userId = null; + } + + /** Returns true if field userId is set (has been assigned a value) and false otherwise */ + public boolean isSetUserId() { + return this.userId != null; + } + + public void setUserIdIsSet(boolean value) { + if (!value) { + this.userId = null; + } + } + + public int getAge() { + return this.age; + } + + public User setAge(int age) { + this.age = age; + setAgeIsSet(true); + return this; + } + + public void unsetAge() { + __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __AGE_ISSET_ID); + } + + /** Returns true if field age is set (has been assigned a value) and false otherwise */ + public boolean isSetAge() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __AGE_ISSET_ID); + } + + public void setAgeIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __AGE_ISSET_ID, value); + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case NAME: + if (value == null) { + unsetName(); + } else { + setName((java.lang.String) value); + } + break; + + case USER_ID: + if (value == null) { + unsetUserId(); + } else { + setUserId((java.lang.String) value); + } + break; + + case AGE: + if (value == null) { + unsetAge(); + } else { + setAge((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case NAME: + return getName(); + + case USER_ID: + return getUserId(); + + case AGE: + return getAge(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case NAME: + return isSetName(); + case USER_ID: + return isSetUserId(); + case AGE: + return isSetAge(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof User) return this.equals((User) that); + return false; + } + + public boolean equals(User that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + boolean this_present_userId = true && this.isSetUserId(); + boolean that_present_userId = true && that.isSetUserId(); + if (this_present_userId || that_present_userId) { + if (!(this_present_userId && that_present_userId)) return false; + if (!this.userId.equals(that.userId)) return false; + } + + boolean this_present_age = true; + boolean that_present_age = true; + if (this_present_age || that_present_age) { + if (!(this_present_age && that_present_age)) return false; + if (this.age != that.age) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + hashCode = hashCode * 8191 + ((isSetUserId()) ? 131071 : 524287); + if (isSetUserId()) hashCode = hashCode * 8191 + userId.hashCode(); + + hashCode = hashCode * 8191 + age; + + return hashCode; + } + + @Override + public int compareTo(User other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetName(), other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetUserId(), other.isSetUserId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAge(), other.isSetAge()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAge()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.age, other.age); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("User("); + boolean first = true; + + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + if (!first) sb.append(", "); + sb.append("userId:"); + if (this.userId == null) { + sb.append("null"); + } else { + sb.append(this.userId); + } + first = false; + if (!first) sb.append(", "); + sb.append("age:"); + sb.append(this.age); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (name == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'name' was not present! Struct: " + toString()); + } + if (userId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'userId' was not present! Struct: " + toString()); + } + // alas, we cannot check 'age' because it's a primitive and you chose the non-beans generator. + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + @Override + public UserStandardScheme getScheme() { + return new UserStandardScheme(); + } + } + + private static class UserStandardScheme extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // AGE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + if (!struct.isSetAge()) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'age' was not found in serialized data! Struct: " + toString()); + } + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, User struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + if (struct.userId != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userId); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(AGE_FIELD_DESC); + oprot.writeI32(struct.age); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + @Override + public UserTupleScheme getScheme() { + return new UserTupleScheme(); + } + } + + private static class UserTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.name); + oprot.writeString(struct.userId); + oprot.writeI32(struct.age); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.name = iprot.readString(); + struct.setNameIsSet(true); + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_18_0/UserAccount.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_18_0/UserAccount.java new file mode 100644 index 000000000000..8ee47c9fb899 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_18_0/UserAccount.java @@ -0,0 +1,520 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_18_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.18.0)", + date = "2025-02-27") +public class UserAccount + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("UserAccount"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserAccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserAccountTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable User user; // required + public @org.apache.thrift.annotation.Nullable Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserAccount.class, metaDataMap); + } + + public UserAccount() {} + + public UserAccount(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public UserAccount(UserAccount other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + @Override + public UserAccount deepCopy() { + return new UserAccount(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + @org.apache.thrift.annotation.Nullable + public User getUser() { + return this.user; + } + + public UserAccount setUser(@org.apache.thrift.annotation.Nullable User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + @org.apache.thrift.annotation.Nullable + public Account getAccount() { + return this.account; + } + + public UserAccount setAccount(@org.apache.thrift.annotation.Nullable Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof UserAccount) return this.equals((UserAccount) that); + return false; + } + + public boolean equals(UserAccount that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(UserAccount other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetUser(), other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAccount(), other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("UserAccount("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (user == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'user' was not present! Struct: " + toString()); + } + if (account == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'account' was not present! Struct: " + toString()); + } + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserAccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public UserAccountStandardScheme getScheme() { + return new UserAccountStandardScheme(); + } + } + + private static class UserAccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, UserAccount struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserAccountTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public UserAccountTupleScheme getScheme() { + return new UserAccountTupleScheme(); + } + } + + private static class UserAccountTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user.write(oprot); + struct.account.write(oprot); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_18_1/Account.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_18_1/Account.java new file mode 100644 index 000000000000..f3ef7d9a56d5 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_18_1/Account.java @@ -0,0 +1,508 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_18_1; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.18.1)", + date = "2025-02-27") +public class Account + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("Account"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField CARD_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "cardId", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new AccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new AccountTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String zone; // required + public @org.apache.thrift.annotation.Nullable java.lang.String cardId; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + CARD_ID((short) 2, "cardId"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // CARD_ID + return CARD_ID; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.CARD_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "cardId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Account.class, metaDataMap); + } + + public Account() {} + + public Account(java.lang.String zone, java.lang.String cardId) { + this(); + this.zone = zone; + this.cardId = cardId; + } + + /** Performs a deep copy on other. */ + public Account(Account other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetCardId()) { + this.cardId = other.cardId; + } + } + + @Override + public Account deepCopy() { + return new Account(this); + } + + @Override + public void clear() { + this.zone = null; + this.cardId = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getZone() { + return this.zone; + } + + public Account setZone(@org.apache.thrift.annotation.Nullable java.lang.String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getCardId() { + return this.cardId; + } + + public Account setCardId(@org.apache.thrift.annotation.Nullable java.lang.String cardId) { + this.cardId = cardId; + return this; + } + + public void unsetCardId() { + this.cardId = null; + } + + /** Returns true if field cardId is set (has been assigned a value) and false otherwise */ + public boolean isSetCardId() { + return this.cardId != null; + } + + public void setCardIdIsSet(boolean value) { + if (!value) { + this.cardId = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((java.lang.String) value); + } + break; + + case CARD_ID: + if (value == null) { + unsetCardId(); + } else { + setCardId((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case CARD_ID: + return getCardId(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case CARD_ID: + return isSetCardId(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof Account) return this.equals((Account) that); + return false; + } + + public boolean equals(Account that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_cardId = true && this.isSetCardId(); + boolean that_present_cardId = true && that.isSetCardId(); + if (this_present_cardId || that_present_cardId) { + if (!(this_present_cardId && that_present_cardId)) return false; + if (!this.cardId.equals(that.cardId)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetCardId()) ? 131071 : 524287); + if (isSetCardId()) hashCode = hashCode * 8191 + cardId.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(Account other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetZone(), other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetCardId(), other.isSetCardId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCardId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cardId, other.cardId); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("Account("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("cardId:"); + if (this.cardId == null) { + sb.append("null"); + } else { + sb.append(this.cardId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (zone == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'zone' was not present! Struct: " + toString()); + } + if (cardId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'cardId' was not present! Struct: " + toString()); + } + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class AccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public AccountStandardScheme getScheme() { + return new AccountStandardScheme(); + } + } + + private static class AccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // CARD_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, Account struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.cardId != null) { + oprot.writeFieldBegin(CARD_ID_FIELD_DESC); + oprot.writeString(struct.cardId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class AccountTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + @Override + public AccountTupleScheme getScheme() { + return new AccountTupleScheme(); + } + } + + private static class AccountTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.zone); + oprot.writeString(struct.cardId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_18_1/ThriftService.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_18_1/ThriftService.java new file mode 100644 index 000000000000..1e696b1738fa --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_18_1/ThriftService.java @@ -0,0 +1,8475 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_18_1; + +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.18.1)", + date = "2025-02-27") +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +public class ThriftService { + + public interface Iface { + + public java.lang.String sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException; + + public java.lang.String withDelay(int delay) throws org.apache.thrift.TException; + + public java.lang.String withoutArgs() throws org.apache.thrift.TException; + + public java.lang.String withError() throws org.apache.thrift.TException; + + public java.lang.String withCollisioin(java.lang.String input) + throws org.apache.thrift.TException; + + public void noReturn(int delay) throws org.apache.thrift.TException; + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException; + + public void oneWay() throws org.apache.thrift.TException; + + public void oneWayWithError() throws org.apache.thrift.TException; + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException; + } + + public interface AsyncIface { + + public void sayHello( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withCollisioin( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + } + + public static class Client extends org.apache.thrift.TServiceClient implements Iface { + public static class Factory implements org.apache.thrift.TServiceClientFactory { + public Factory() {} + + @Override + public Client getClient(org.apache.thrift.protocol.TProtocol prot) { + return new Client(prot); + } + + @Override + public Client getClient( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + return new Client(iprot, oprot); + } + } + + public Client(org.apache.thrift.protocol.TProtocol prot) { + super(prot, prot); + } + + public Client( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + super(iprot, oprot); + } + + @Override + public java.lang.String sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException { + send_sayHello(zone, name); + return recv_sayHello(); + } + + public void send_sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException { + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + sendBase("sayHello", args); + } + + public java.lang.String recv_sayHello() throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + receiveBase(result, "sayHello"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "sayHello failed: unknown result"); + } + + @Override + public java.lang.String withDelay(int delay) throws org.apache.thrift.TException { + send_withDelay(delay); + return recv_withDelay(); + } + + public void send_withDelay(int delay) throws org.apache.thrift.TException { + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + sendBase("withDelay", args); + } + + public java.lang.String recv_withDelay() throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + receiveBase(result, "withDelay"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withDelay failed: unknown result"); + } + + @Override + public java.lang.String withoutArgs() throws org.apache.thrift.TException { + send_withoutArgs(); + return recv_withoutArgs(); + } + + public void send_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_args args = new withoutArgs_args(); + sendBase("withoutArgs", args); + } + + public java.lang.String recv_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + receiveBase(result, "withoutArgs"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withoutArgs failed: unknown result"); + } + + @Override + public java.lang.String withError() throws org.apache.thrift.TException { + send_withError(); + return recv_withError(); + } + + public void send_withError() throws org.apache.thrift.TException { + withError_args args = new withError_args(); + sendBase("withError", args); + } + + public java.lang.String recv_withError() throws org.apache.thrift.TException { + withError_result result = new withError_result(); + receiveBase(result, "withError"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withError failed: unknown result"); + } + + @Override + public java.lang.String withCollisioin(java.lang.String input) + throws org.apache.thrift.TException { + send_withCollisioin(input); + return recv_withCollisioin(); + } + + public void send_withCollisioin(java.lang.String input) throws org.apache.thrift.TException { + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + sendBase("withCollisioin", args); + } + + public java.lang.String recv_withCollisioin() throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + receiveBase(result, "withCollisioin"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withCollisioin failed: unknown result"); + } + + @Override + public void noReturn(int delay) throws org.apache.thrift.TException { + send_noReturn(delay); + recv_noReturn(); + } + + public void send_noReturn(int delay) throws org.apache.thrift.TException { + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + sendBase("noReturn", args); + } + + public void recv_noReturn() throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + receiveBase(result, "noReturn"); + return; + } + + @Override + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException { + send_oneWayHasArgs(delay); + } + + public void send_oneWayHasArgs(int delay) throws org.apache.thrift.TException { + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + sendBaseOneway("oneWayHasArgs", args); + } + + @Override + public void oneWay() throws org.apache.thrift.TException { + send_oneWay(); + } + + public void send_oneWay() throws org.apache.thrift.TException { + oneWay_args args = new oneWay_args(); + sendBaseOneway("oneWay", args); + } + + @Override + public void oneWayWithError() throws org.apache.thrift.TException { + send_oneWayWithError(); + } + + public void send_oneWayWithError() throws org.apache.thrift.TException { + oneWayWithError_args args = new oneWayWithError_args(); + sendBaseOneway("oneWayWithError", args); + } + + @Override + public UserAccount data(User user, Account account) throws org.apache.thrift.TException { + send_data(user, account); + return recv_data(); + } + + public void send_data(User user, Account account) throws org.apache.thrift.TException { + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + sendBase("data", args); + } + + public UserAccount recv_data() throws org.apache.thrift.TException { + data_result result = new data_result(); + receiveBase(result, "data"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, "data failed: unknown result"); + } + } + + public static class AsyncClient extends org.apache.thrift.async.TAsyncClient + implements AsyncIface { + public static class Factory + implements org.apache.thrift.async.TAsyncClientFactory { + private org.apache.thrift.async.TAsyncClientManager clientManager; + private org.apache.thrift.protocol.TProtocolFactory protocolFactory; + + public Factory( + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.protocol.TProtocolFactory protocolFactory) { + this.clientManager = clientManager; + this.protocolFactory = protocolFactory; + } + + @Override + public AsyncClient getAsyncClient( + org.apache.thrift.transport.TNonblockingTransport transport) { + return new AsyncClient(protocolFactory, clientManager, transport); + } + } + + public AsyncClient( + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.transport.TNonblockingTransport transport) { + super(protocolFactory, clientManager, transport); + } + + @Override + public void sayHello( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + sayHello_call method_call = + new sayHello_call(zone, name, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class sayHello_call + extends org.apache.thrift.async.TAsyncMethodCall { + private java.lang.String zone; + private java.lang.String name; + + public sayHello_call( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.zone = zone; + this.name = name; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "sayHello", org.apache.thrift.protocol.TMessageType.CALL, 0)); + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_sayHello(); + } + } + + @Override + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withDelay_call method_call = + new withDelay_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withDelay_call + extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public withDelay_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withDelay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withDelay(); + } + } + + @Override + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withoutArgs_call method_call = + new withoutArgs_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withoutArgs_call + extends org.apache.thrift.async.TAsyncMethodCall { + public withoutArgs_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withoutArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withoutArgs_args args = new withoutArgs_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withoutArgs(); + } + } + + @Override + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withError_call method_call = + new withError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withError_call + extends org.apache.thrift.async.TAsyncMethodCall { + public withError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withError_args args = new withError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withError(); + } + } + + @Override + public void withCollisioin( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withCollisioin_call method_call = + new withCollisioin_call(input, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withCollisioin_call + extends org.apache.thrift.async.TAsyncMethodCall { + private java.lang.String input; + + public withCollisioin_call( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.input = input; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withCollisioin", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withCollisioin(); + } + } + + @Override + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + noReturn_call method_call = + new noReturn_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class noReturn_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public noReturn_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "noReturn", org.apache.thrift.protocol.TMessageType.CALL, 0)); + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + (new Client(prot)).recv_noReturn(); + return null; + } + } + + @Override + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayHasArgs_call method_call = + new oneWayHasArgs_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayHasArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public oneWayHasArgs_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + this.delay = delay; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayHasArgs", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + @Override + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWay_call method_call = + new oneWay_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWay_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWay_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWay", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWay_args args = new oneWay_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + @Override + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayWithError_call method_call = + new oneWayWithError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayWithError_call + extends org.apache.thrift.async.TAsyncMethodCall { + public oneWayWithError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayWithError", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayWithError_args args = new oneWayWithError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + @Override + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + data_call method_call = + new data_call(user, account, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class data_call extends org.apache.thrift.async.TAsyncMethodCall { + private User user; + private Account account; + + public data_call( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.user = user; + this.account = account; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "data", org.apache.thrift.protocol.TMessageType.CALL, 0)); + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public UserAccount getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_data(); + } + } + } + + public static class Processor extends org.apache.thrift.TBaseProcessor + implements org.apache.thrift.TProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(Processor.class.getName()); + + public Processor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + java.lang.String, + org.apache.thrift.ProcessFunction>())); + } + + protected Processor( + I iface, + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + getProcessMap( + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.ProcessFunction { + public sayHello() { + super("sayHello"); + } + + @Override + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public sayHello_result getResult(I iface, sayHello_args args) + throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + result.success = iface.sayHello(args.zone, args.name); + return result; + } + } + + public static class withDelay + extends org.apache.thrift.ProcessFunction { + public withDelay() { + super("withDelay"); + } + + @Override + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public withDelay_result getResult(I iface, withDelay_args args) + throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + result.success = iface.withDelay(args.delay); + return result; + } + } + + public static class withoutArgs + extends org.apache.thrift.ProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + @Override + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public withoutArgs_result getResult(I iface, withoutArgs_args args) + throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + result.success = iface.withoutArgs(); + return result; + } + } + + public static class withError + extends org.apache.thrift.ProcessFunction { + public withError() { + super("withError"); + } + + @Override + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public withError_result getResult(I iface, withError_args args) + throws org.apache.thrift.TException { + withError_result result = new withError_result(); + result.success = iface.withError(); + return result; + } + } + + public static class withCollisioin + extends org.apache.thrift.ProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + @Override + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public withCollisioin_result getResult(I iface, withCollisioin_args args) + throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + result.success = iface.withCollisioin(args.input); + return result; + } + } + + public static class noReturn + extends org.apache.thrift.ProcessFunction { + public noReturn() { + super("noReturn"); + } + + @Override + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public noReturn_result getResult(I iface, noReturn_args args) + throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + iface.noReturn(args.delay); + return result; + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.ProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + @Override + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + @Override + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public org.apache.thrift.TBase getResult(I iface, oneWayHasArgs_args args) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay); + return null; + } + } + + public static class oneWay + extends org.apache.thrift.ProcessFunction { + public oneWay() { + super("oneWay"); + } + + @Override + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + @Override + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public org.apache.thrift.TBase getResult(I iface, oneWay_args args) + throws org.apache.thrift.TException { + iface.oneWay(); + return null; + } + } + + public static class oneWayWithError + extends org.apache.thrift.ProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + @Override + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + @Override + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public org.apache.thrift.TBase getResult(I iface, oneWayWithError_args args) + throws org.apache.thrift.TException { + iface.oneWayWithError(); + return null; + } + } + + public static class data + extends org.apache.thrift.ProcessFunction { + public data() { + super("data"); + } + + @Override + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public data_result getResult(I iface, data_args args) throws org.apache.thrift.TException { + data_result result = new data_result(); + result.success = iface.data(args.user, args.account); + return result; + } + } + } + + public static class AsyncProcessor + extends org.apache.thrift.TBaseAsyncProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(AsyncProcessor.class.getName()); + + public AsyncProcessor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>>())); + } + + protected AsyncProcessor( + I iface, + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction> + getProcessMap( + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.AsyncProcessFunction { + public sayHello() { + super("sayHello"); + } + + @Override + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(java.lang.String o) { + sayHello_result result = new sayHello_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + sayHello_result result = new sayHello_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + sayHello_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.sayHello(args.zone, args.name, resultHandler); + } + } + + public static class withDelay + extends org.apache.thrift.AsyncProcessFunction { + public withDelay() { + super("withDelay"); + } + + @Override + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(java.lang.String o) { + withDelay_result result = new withDelay_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withDelay_result result = new withDelay_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + withDelay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withDelay(args.delay, resultHandler); + } + } + + public static class withoutArgs + extends org.apache.thrift.AsyncProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + @Override + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(java.lang.String o) { + withoutArgs_result result = new withoutArgs_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withoutArgs_result result = new withoutArgs_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + withoutArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withoutArgs(resultHandler); + } + } + + public static class withError + extends org.apache.thrift.AsyncProcessFunction { + public withError() { + super("withError"); + } + + @Override + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(java.lang.String o) { + withError_result result = new withError_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withError_result result = new withError_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + withError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withError(resultHandler); + } + } + + public static class withCollisioin + extends org.apache.thrift.AsyncProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + @Override + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(java.lang.String o) { + withCollisioin_result result = new withCollisioin_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withCollisioin_result result = new withCollisioin_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + withCollisioin_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withCollisioin(args.input, resultHandler); + } + } + + public static class noReturn + extends org.apache.thrift.AsyncProcessFunction { + public noReturn() { + super("noReturn"); + } + + @Override + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(Void o) { + noReturn_result result = new noReturn_result(); + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + noReturn_result result = new noReturn_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + noReturn_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.noReturn(args.delay, resultHandler); + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.AsyncProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + @Override + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(Void o) {} + + @Override + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + @Override + protected boolean isOneway() { + return true; + } + + @Override + public void start( + I iface, + oneWayHasArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay, resultHandler); + } + } + + public static class oneWay + extends org.apache.thrift.AsyncProcessFunction { + public oneWay() { + super("oneWay"); + } + + @Override + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(Void o) {} + + @Override + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + @Override + protected boolean isOneway() { + return true; + } + + @Override + public void start( + I iface, + oneWay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWay(resultHandler); + } + } + + public static class oneWayWithError + extends org.apache.thrift.AsyncProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + @Override + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(Void o) {} + + @Override + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + @Override + protected boolean isOneway() { + return true; + } + + @Override + public void start( + I iface, + oneWayWithError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayWithError(resultHandler); + } + } + + public static class data + extends org.apache.thrift.AsyncProcessFunction { + public data() { + super("data"); + } + + @Override + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(UserAccount o) { + data_result result = new data_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + data_result result = new data_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + data_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.data(args.user, args.account, resultHandler); + } + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class sayHello_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_args"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String zone; // required + public @org.apache.thrift.annotation.Nullable java.lang.String name; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + NAME((short) 2, "name"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // NAME + return NAME; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_args.class, metaDataMap); + } + + public sayHello_args() {} + + public sayHello_args(java.lang.String zone, java.lang.String name) { + this(); + this.zone = zone; + this.name = name; + } + + /** Performs a deep copy on other. */ + public sayHello_args(sayHello_args other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetName()) { + this.name = other.name; + } + } + + @Override + public sayHello_args deepCopy() { + return new sayHello_args(this); + } + + @Override + public void clear() { + this.zone = null; + this.name = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getZone() { + return this.zone; + } + + public sayHello_args setZone(@org.apache.thrift.annotation.Nullable java.lang.String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getName() { + return this.name; + } + + public sayHello_args setName(@org.apache.thrift.annotation.Nullable java.lang.String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((java.lang.String) value); + } + break; + + case NAME: + if (value == null) { + unsetName(); + } else { + setName((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case NAME: + return getName(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case NAME: + return isSetName(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof sayHello_args) return this.equals((sayHello_args) that); + return false; + } + + public boolean equals(sayHello_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetZone(), other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetName(), other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("sayHello_args("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public sayHello_argsStandardScheme getScheme() { + return new sayHello_argsStandardScheme(); + } + } + + private static class sayHello_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public sayHello_argsTupleScheme getScheme() { + return new sayHello_argsTupleScheme(); + } + } + + private static class sayHello_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetZone()) { + optionals.set(0); + } + if (struct.isSetName()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetZone()) { + oprot.writeString(struct.zone); + } + if (struct.isSetName()) { + oprot.writeString(struct.name); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } + if (incoming.get(1)) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class sayHello_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_result.class, metaDataMap); + } + + public sayHello_result() {} + + public sayHello_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public sayHello_result(sayHello_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + @Override + public sayHello_result deepCopy() { + return new sayHello_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public sayHello_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof sayHello_result) return this.equals((sayHello_result) that); + return false; + } + + public boolean equals(sayHello_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("sayHello_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public sayHello_resultStandardScheme getScheme() { + return new sayHello_resultStandardScheme(); + } + } + + private static class sayHello_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public sayHello_resultTupleScheme getScheme() { + return new sayHello_resultTupleScheme(); + } + } + + private static class sayHello_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withDelay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_args.class, metaDataMap); + } + + public withDelay_args() {} + + public withDelay_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public withDelay_args(withDelay_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + @Override + public withDelay_args deepCopy() { + return new withDelay_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public withDelay_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withDelay_args) return this.equals((withDelay_args) that); + return false; + } + + public boolean equals(withDelay_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(withDelay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withDelay_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withDelay_argsStandardScheme getScheme() { + return new withDelay_argsStandardScheme(); + } + } + + private static class withDelay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withDelay_argsTupleScheme getScheme() { + return new withDelay_argsTupleScheme(); + } + } + + private static class withDelay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withDelay_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_result.class, metaDataMap); + } + + public withDelay_result() {} + + public withDelay_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withDelay_result(withDelay_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + @Override + public withDelay_result deepCopy() { + return new withDelay_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withDelay_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withDelay_result) return this.equals((withDelay_result) that); + return false; + } + + public boolean equals(withDelay_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withDelay_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withDelay_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withDelay_resultStandardScheme getScheme() { + return new withDelay_resultStandardScheme(); + } + } + + private static class withDelay_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withDelay_resultTupleScheme getScheme() { + return new withDelay_resultTupleScheme(); + } + } + + private static class withDelay_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withoutArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_args.class, metaDataMap); + } + + public withoutArgs_args() {} + + /** Performs a deep copy on other. */ + public withoutArgs_args(withoutArgs_args other) {} + + @Override + public withoutArgs_args deepCopy() { + return new withoutArgs_args(this); + } + + @Override + public void clear() {} + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withoutArgs_args) return this.equals((withoutArgs_args) that); + return false; + } + + public boolean equals(withoutArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withoutArgs_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withoutArgs_argsStandardScheme getScheme() { + return new withoutArgs_argsStandardScheme(); + } + } + + private static class withoutArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withoutArgs_argsTupleScheme getScheme() { + return new withoutArgs_argsTupleScheme(); + } + } + + private static class withoutArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withoutArgs_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_result.class, metaDataMap); + } + + public withoutArgs_result() {} + + public withoutArgs_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withoutArgs_result(withoutArgs_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + @Override + public withoutArgs_result deepCopy() { + return new withoutArgs_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withoutArgs_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withoutArgs_result) return this.equals((withoutArgs_result) that); + return false; + } + + public boolean equals(withoutArgs_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withoutArgs_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withoutArgs_resultStandardScheme getScheme() { + return new withoutArgs_resultStandardScheme(); + } + } + + private static class withoutArgs_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withoutArgs_resultTupleScheme getScheme() { + return new withoutArgs_resultTupleScheme(); + } + } + + private static class withoutArgs_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_args.class, metaDataMap); + } + + public withError_args() {} + + /** Performs a deep copy on other. */ + public withError_args(withError_args other) {} + + @Override + public withError_args deepCopy() { + return new withError_args(this); + } + + @Override + public void clear() {} + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withError_args) return this.equals((withError_args) that); + return false; + } + + public boolean equals(withError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withError_argsStandardScheme getScheme() { + return new withError_argsStandardScheme(); + } + } + + private static class withError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withError_argsTupleScheme getScheme() { + return new withError_argsTupleScheme(); + } + } + + private static class withError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withError_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_result.class, metaDataMap); + } + + public withError_result() {} + + public withError_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withError_result(withError_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + @Override + public withError_result deepCopy() { + return new withError_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withError_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withError_result) return this.equals((withError_result) that); + return false; + } + + public boolean equals(withError_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withError_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withError_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withError_resultStandardScheme getScheme() { + return new withError_resultStandardScheme(); + } + } + + private static class withError_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withError_resultTupleScheme getScheme() { + return new withError_resultTupleScheme(); + } + } + + private static class withError_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withCollisioin_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_args"); + + private static final org.apache.thrift.protocol.TField INPUT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "input", org.apache.thrift.protocol.TType.STRING, (short) 3333); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String input; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + INPUT((short) 3333, "input"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 3333: // INPUT + return INPUT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.INPUT, + new org.apache.thrift.meta_data.FieldMetaData( + "input", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_args.class, metaDataMap); + } + + public withCollisioin_args() {} + + public withCollisioin_args(java.lang.String input) { + this(); + this.input = input; + } + + /** Performs a deep copy on other. */ + public withCollisioin_args(withCollisioin_args other) { + if (other.isSetInput()) { + this.input = other.input; + } + } + + @Override + public withCollisioin_args deepCopy() { + return new withCollisioin_args(this); + } + + @Override + public void clear() { + this.input = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getInput() { + return this.input; + } + + public withCollisioin_args setInput( + @org.apache.thrift.annotation.Nullable java.lang.String input) { + this.input = input; + return this; + } + + public void unsetInput() { + this.input = null; + } + + /** Returns true if field input is set (has been assigned a value) and false otherwise */ + public boolean isSetInput() { + return this.input != null; + } + + public void setInputIsSet(boolean value) { + if (!value) { + this.input = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case INPUT: + if (value == null) { + unsetInput(); + } else { + setInput((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case INPUT: + return getInput(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case INPUT: + return isSetInput(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withCollisioin_args) return this.equals((withCollisioin_args) that); + return false; + } + + public boolean equals(withCollisioin_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_input = true && this.isSetInput(); + boolean that_present_input = true && that.isSetInput(); + if (this_present_input || that_present_input) { + if (!(this_present_input && that_present_input)) return false; + if (!this.input.equals(that.input)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetInput()) ? 131071 : 524287); + if (isSetInput()) hashCode = hashCode * 8191 + input.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetInput(), other.isSetInput()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInput()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.input, other.input); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withCollisioin_args("); + boolean first = true; + + sb.append("input:"); + if (this.input == null) { + sb.append("null"); + } else { + sb.append(this.input); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withCollisioin_argsStandardScheme getScheme() { + return new withCollisioin_argsStandardScheme(); + } + } + + private static class withCollisioin_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 3333: // INPUT + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.input != null) { + oprot.writeFieldBegin(INPUT_FIELD_DESC); + oprot.writeString(struct.input); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withCollisioin_argsTupleScheme getScheme() { + return new withCollisioin_argsTupleScheme(); + } + } + + private static class withCollisioin_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetInput()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetInput()) { + oprot.writeString(struct.input); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withCollisioin_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_result.class, metaDataMap); + } + + public withCollisioin_result() {} + + public withCollisioin_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withCollisioin_result(withCollisioin_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + @Override + public withCollisioin_result deepCopy() { + return new withCollisioin_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withCollisioin_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withCollisioin_result) return this.equals((withCollisioin_result) that); + return false; + } + + public boolean equals(withCollisioin_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withCollisioin_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withCollisioin_resultStandardScheme getScheme() { + return new withCollisioin_resultStandardScheme(); + } + } + + private static class withCollisioin_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withCollisioin_resultTupleScheme getScheme() { + return new withCollisioin_resultTupleScheme(); + } + } + + private static class withCollisioin_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class noReturn_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_args.class, metaDataMap); + } + + public noReturn_args() {} + + public noReturn_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public noReturn_args(noReturn_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + @Override + public noReturn_args deepCopy() { + return new noReturn_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public noReturn_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof noReturn_args) return this.equals((noReturn_args) that); + return false; + } + + public boolean equals(noReturn_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(noReturn_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("noReturn_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public noReturn_argsStandardScheme getScheme() { + return new noReturn_argsStandardScheme(); + } + } + + private static class noReturn_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public noReturn_argsTupleScheme getScheme() { + return new noReturn_argsTupleScheme(); + } + } + + private static class noReturn_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class noReturn_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_result"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_resultTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_result.class, metaDataMap); + } + + public noReturn_result() {} + + /** Performs a deep copy on other. */ + public noReturn_result(noReturn_result other) {} + + @Override + public noReturn_result deepCopy() { + return new noReturn_result(this); + } + + @Override + public void clear() {} + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof noReturn_result) return this.equals((noReturn_result) that); + return false; + } + + public boolean equals(noReturn_result that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(noReturn_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("noReturn_result("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public noReturn_resultStandardScheme getScheme() { + return new noReturn_resultStandardScheme(); + } + } + + private static class noReturn_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public noReturn_resultTupleScheme getScheme() { + return new noReturn_resultTupleScheme(); + } + } + + private static class noReturn_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class oneWayHasArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayHasArgs_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayHasArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayHasArgs_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayHasArgs_args.class, metaDataMap); + } + + public oneWayHasArgs_args() {} + + public oneWayHasArgs_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public oneWayHasArgs_args(oneWayHasArgs_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + @Override + public oneWayHasArgs_args deepCopy() { + return new oneWayHasArgs_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public oneWayHasArgs_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWayHasArgs_args) return this.equals((oneWayHasArgs_args) that); + return false; + } + + public boolean equals(oneWayHasArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(oneWayHasArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWayHasArgs_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayHasArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWayHasArgs_argsStandardScheme getScheme() { + return new oneWayHasArgs_argsStandardScheme(); + } + } + + private static class oneWayHasArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayHasArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWayHasArgs_argsTupleScheme getScheme() { + return new oneWayHasArgs_argsTupleScheme(); + } + } + + private static class oneWayHasArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class oneWay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWay_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWay_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWay_args.class, metaDataMap); + } + + public oneWay_args() {} + + /** Performs a deep copy on other. */ + public oneWay_args(oneWay_args other) {} + + @Override + public oneWay_args deepCopy() { + return new oneWay_args(this); + } + + @Override + public void clear() {} + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWay_args) return this.equals((oneWay_args) that); + return false; + } + + public boolean equals(oneWay_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWay_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWay_argsStandardScheme getScheme() { + return new oneWay_argsStandardScheme(); + } + } + + private static class oneWay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWay_argsTupleScheme getScheme() { + return new oneWay_argsTupleScheme(); + } + } + + private static class oneWay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class oneWayWithError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayWithError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayWithError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayWithError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayWithError_args.class, metaDataMap); + } + + public oneWayWithError_args() {} + + /** Performs a deep copy on other. */ + public oneWayWithError_args(oneWayWithError_args other) {} + + @Override + public oneWayWithError_args deepCopy() { + return new oneWayWithError_args(this); + } + + @Override + public void clear() {} + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWayWithError_args) return this.equals((oneWayWithError_args) that); + return false; + } + + public boolean equals(oneWayWithError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWayWithError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWayWithError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayWithError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWayWithError_argsStandardScheme getScheme() { + return new oneWayWithError_argsStandardScheme(); + } + } + + private static class oneWayWithError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayWithError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWayWithError_argsTupleScheme getScheme() { + return new oneWayWithError_argsTupleScheme(); + } + } + + private static class oneWayWithError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class data_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_args"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable User user; // required + public @org.apache.thrift.annotation.Nullable Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(data_args.class, metaDataMap); + } + + public data_args() {} + + public data_args(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public data_args(data_args other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + @Override + public data_args deepCopy() { + return new data_args(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + @org.apache.thrift.annotation.Nullable + public User getUser() { + return this.user; + } + + public data_args setUser(@org.apache.thrift.annotation.Nullable User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + @org.apache.thrift.annotation.Nullable + public Account getAccount() { + return this.account; + } + + public data_args setAccount(@org.apache.thrift.annotation.Nullable Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof data_args) return this.equals((data_args) that); + return false; + } + + public boolean equals(data_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetUser(), other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAccount(), other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("data_args("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public data_argsStandardScheme getScheme() { + return new data_argsStandardScheme(); + } + } + + private static class data_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, data_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public data_argsTupleScheme getScheme() { + return new data_argsTupleScheme(); + } + } + + private static class data_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetUser()) { + optionals.set(0); + } + if (struct.isSetAccount()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetUser()) { + struct.user.write(oprot); + } + if (struct.isSetAccount()) { + struct.account.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } + if (incoming.get(1)) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class data_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRUCT, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable UserAccount success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, UserAccount.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + data_result.class, metaDataMap); + } + + public data_result() {} + + public data_result(UserAccount success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public data_result(data_result other) { + if (other.isSetSuccess()) { + this.success = new UserAccount(other.success); + } + } + + @Override + public data_result deepCopy() { + return new data_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public UserAccount getSuccess() { + return this.success; + } + + public data_result setSuccess(@org.apache.thrift.annotation.Nullable UserAccount success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((UserAccount) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof data_result) return this.equals((data_result) that); + return false; + } + + public boolean equals(data_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("data_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public data_resultStandardScheme getScheme() { + return new data_resultStandardScheme(); + } + } + + private static class data_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, data_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public data_resultTupleScheme getScheme() { + return new data_resultTupleScheme(); + } + } + + private static class data_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_18_1/User.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_18_1/User.java new file mode 100644 index 000000000000..5b65be94fa9f --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_18_1/User.java @@ -0,0 +1,609 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_18_1; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.18.1)", + date = "2025-02-27") +public class User + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("User"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "userId", org.apache.thrift.protocol.TType.STRING, (short) 2); + private static final org.apache.thrift.protocol.TField AGE_FIELD_DESC = + new org.apache.thrift.protocol.TField("age", org.apache.thrift.protocol.TType.I32, (short) 3); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String name; // required + public @org.apache.thrift.annotation.Nullable java.lang.String userId; // required + public int age; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + NAME((short) 1, "name"), + USER_ID((short) 2, "userId"), + AGE((short) 3, "age"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // NAME + return NAME; + case 2: // USER_ID + return USER_ID; + case 3: // AGE + return AGE; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __AGE_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.USER_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "userId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.AGE, + new org.apache.thrift.meta_data.FieldMetaData( + "age", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(User.class, metaDataMap); + } + + public User() {} + + public User(java.lang.String name, java.lang.String userId, int age) { + this(); + this.name = name; + this.userId = userId; + this.age = age; + setAgeIsSet(true); + } + + /** Performs a deep copy on other. */ + public User(User other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetName()) { + this.name = other.name; + } + if (other.isSetUserId()) { + this.userId = other.userId; + } + this.age = other.age; + } + + @Override + public User deepCopy() { + return new User(this); + } + + @Override + public void clear() { + this.name = null; + this.userId = null; + setAgeIsSet(false); + this.age = 0; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getName() { + return this.name; + } + + public User setName(@org.apache.thrift.annotation.Nullable java.lang.String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getUserId() { + return this.userId; + } + + public User setUserId(@org.apache.thrift.annotation.Nullable java.lang.String userId) { + this.userId = userId; + return this; + } + + public void unsetUserId() { + this.userId = null; + } + + /** Returns true if field userId is set (has been assigned a value) and false otherwise */ + public boolean isSetUserId() { + return this.userId != null; + } + + public void setUserIdIsSet(boolean value) { + if (!value) { + this.userId = null; + } + } + + public int getAge() { + return this.age; + } + + public User setAge(int age) { + this.age = age; + setAgeIsSet(true); + return this; + } + + public void unsetAge() { + __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __AGE_ISSET_ID); + } + + /** Returns true if field age is set (has been assigned a value) and false otherwise */ + public boolean isSetAge() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __AGE_ISSET_ID); + } + + public void setAgeIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __AGE_ISSET_ID, value); + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case NAME: + if (value == null) { + unsetName(); + } else { + setName((java.lang.String) value); + } + break; + + case USER_ID: + if (value == null) { + unsetUserId(); + } else { + setUserId((java.lang.String) value); + } + break; + + case AGE: + if (value == null) { + unsetAge(); + } else { + setAge((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case NAME: + return getName(); + + case USER_ID: + return getUserId(); + + case AGE: + return getAge(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case NAME: + return isSetName(); + case USER_ID: + return isSetUserId(); + case AGE: + return isSetAge(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof User) return this.equals((User) that); + return false; + } + + public boolean equals(User that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + boolean this_present_userId = true && this.isSetUserId(); + boolean that_present_userId = true && that.isSetUserId(); + if (this_present_userId || that_present_userId) { + if (!(this_present_userId && that_present_userId)) return false; + if (!this.userId.equals(that.userId)) return false; + } + + boolean this_present_age = true; + boolean that_present_age = true; + if (this_present_age || that_present_age) { + if (!(this_present_age && that_present_age)) return false; + if (this.age != that.age) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + hashCode = hashCode * 8191 + ((isSetUserId()) ? 131071 : 524287); + if (isSetUserId()) hashCode = hashCode * 8191 + userId.hashCode(); + + hashCode = hashCode * 8191 + age; + + return hashCode; + } + + @Override + public int compareTo(User other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetName(), other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetUserId(), other.isSetUserId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAge(), other.isSetAge()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAge()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.age, other.age); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("User("); + boolean first = true; + + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + if (!first) sb.append(", "); + sb.append("userId:"); + if (this.userId == null) { + sb.append("null"); + } else { + sb.append(this.userId); + } + first = false; + if (!first) sb.append(", "); + sb.append("age:"); + sb.append(this.age); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (name == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'name' was not present! Struct: " + toString()); + } + if (userId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'userId' was not present! Struct: " + toString()); + } + // alas, we cannot check 'age' because it's a primitive and you chose the non-beans generator. + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + @Override + public UserStandardScheme getScheme() { + return new UserStandardScheme(); + } + } + + private static class UserStandardScheme extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // AGE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + if (!struct.isSetAge()) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'age' was not found in serialized data! Struct: " + toString()); + } + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, User struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + if (struct.userId != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userId); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(AGE_FIELD_DESC); + oprot.writeI32(struct.age); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + @Override + public UserTupleScheme getScheme() { + return new UserTupleScheme(); + } + } + + private static class UserTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.name); + oprot.writeString(struct.userId); + oprot.writeI32(struct.age); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.name = iprot.readString(); + struct.setNameIsSet(true); + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_18_1/UserAccount.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_18_1/UserAccount.java new file mode 100644 index 000000000000..aa84b63242c0 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_18_1/UserAccount.java @@ -0,0 +1,520 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_18_1; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.18.1)", + date = "2025-02-27") +public class UserAccount + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("UserAccount"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserAccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserAccountTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable User user; // required + public @org.apache.thrift.annotation.Nullable Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserAccount.class, metaDataMap); + } + + public UserAccount() {} + + public UserAccount(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public UserAccount(UserAccount other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + @Override + public UserAccount deepCopy() { + return new UserAccount(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + @org.apache.thrift.annotation.Nullable + public User getUser() { + return this.user; + } + + public UserAccount setUser(@org.apache.thrift.annotation.Nullable User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + @org.apache.thrift.annotation.Nullable + public Account getAccount() { + return this.account; + } + + public UserAccount setAccount(@org.apache.thrift.annotation.Nullable Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof UserAccount) return this.equals((UserAccount) that); + return false; + } + + public boolean equals(UserAccount that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(UserAccount other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetUser(), other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAccount(), other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("UserAccount("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (user == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'user' was not present! Struct: " + toString()); + } + if (account == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'account' was not present! Struct: " + toString()); + } + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserAccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public UserAccountStandardScheme getScheme() { + return new UserAccountStandardScheme(); + } + } + + private static class UserAccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, UserAccount struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserAccountTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public UserAccountTupleScheme getScheme() { + return new UserAccountTupleScheme(); + } + } + + private static class UserAccountTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user.write(oprot); + struct.account.write(oprot); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_19_0/Account.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_19_0/Account.java new file mode 100644 index 000000000000..c7d726393816 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_19_0/Account.java @@ -0,0 +1,508 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_19_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.19.0)", + date = "2025-02-27") +public class Account + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("Account"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField CARD_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "cardId", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new AccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new AccountTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String zone; // required + public @org.apache.thrift.annotation.Nullable java.lang.String cardId; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + CARD_ID((short) 2, "cardId"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // CARD_ID + return CARD_ID; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.CARD_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "cardId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Account.class, metaDataMap); + } + + public Account() {} + + public Account(java.lang.String zone, java.lang.String cardId) { + this(); + this.zone = zone; + this.cardId = cardId; + } + + /** Performs a deep copy on other. */ + public Account(Account other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetCardId()) { + this.cardId = other.cardId; + } + } + + @Override + public Account deepCopy() { + return new Account(this); + } + + @Override + public void clear() { + this.zone = null; + this.cardId = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getZone() { + return this.zone; + } + + public Account setZone(@org.apache.thrift.annotation.Nullable java.lang.String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getCardId() { + return this.cardId; + } + + public Account setCardId(@org.apache.thrift.annotation.Nullable java.lang.String cardId) { + this.cardId = cardId; + return this; + } + + public void unsetCardId() { + this.cardId = null; + } + + /** Returns true if field cardId is set (has been assigned a value) and false otherwise */ + public boolean isSetCardId() { + return this.cardId != null; + } + + public void setCardIdIsSet(boolean value) { + if (!value) { + this.cardId = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((java.lang.String) value); + } + break; + + case CARD_ID: + if (value == null) { + unsetCardId(); + } else { + setCardId((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case CARD_ID: + return getCardId(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case CARD_ID: + return isSetCardId(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof Account) return this.equals((Account) that); + return false; + } + + public boolean equals(Account that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_cardId = true && this.isSetCardId(); + boolean that_present_cardId = true && that.isSetCardId(); + if (this_present_cardId || that_present_cardId) { + if (!(this_present_cardId && that_present_cardId)) return false; + if (!this.cardId.equals(that.cardId)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetCardId()) ? 131071 : 524287); + if (isSetCardId()) hashCode = hashCode * 8191 + cardId.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(Account other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetZone(), other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetCardId(), other.isSetCardId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCardId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cardId, other.cardId); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("Account("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("cardId:"); + if (this.cardId == null) { + sb.append("null"); + } else { + sb.append(this.cardId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (zone == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'zone' was not present! Struct: " + toString()); + } + if (cardId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'cardId' was not present! Struct: " + toString()); + } + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class AccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public AccountStandardScheme getScheme() { + return new AccountStandardScheme(); + } + } + + private static class AccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // CARD_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, Account struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.cardId != null) { + oprot.writeFieldBegin(CARD_ID_FIELD_DESC); + oprot.writeString(struct.cardId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class AccountTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + @Override + public AccountTupleScheme getScheme() { + return new AccountTupleScheme(); + } + } + + private static class AccountTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.zone); + oprot.writeString(struct.cardId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_19_0/ThriftService.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_19_0/ThriftService.java new file mode 100644 index 000000000000..2bd90d588dac --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_19_0/ThriftService.java @@ -0,0 +1,8475 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_19_0; + +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.19.0)", + date = "2025-02-27") +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +public class ThriftService { + + public interface Iface { + + public java.lang.String sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException; + + public java.lang.String withDelay(int delay) throws org.apache.thrift.TException; + + public java.lang.String withoutArgs() throws org.apache.thrift.TException; + + public java.lang.String withError() throws org.apache.thrift.TException; + + public java.lang.String withCollisioin(java.lang.String input) + throws org.apache.thrift.TException; + + public void noReturn(int delay) throws org.apache.thrift.TException; + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException; + + public void oneWay() throws org.apache.thrift.TException; + + public void oneWayWithError() throws org.apache.thrift.TException; + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException; + } + + public interface AsyncIface { + + public void sayHello( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withCollisioin( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + } + + public static class Client extends org.apache.thrift.TServiceClient implements Iface { + public static class Factory implements org.apache.thrift.TServiceClientFactory { + public Factory() {} + + @Override + public Client getClient(org.apache.thrift.protocol.TProtocol prot) { + return new Client(prot); + } + + @Override + public Client getClient( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + return new Client(iprot, oprot); + } + } + + public Client(org.apache.thrift.protocol.TProtocol prot) { + super(prot, prot); + } + + public Client( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + super(iprot, oprot); + } + + @Override + public java.lang.String sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException { + send_sayHello(zone, name); + return recv_sayHello(); + } + + public void send_sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException { + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + sendBase("sayHello", args); + } + + public java.lang.String recv_sayHello() throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + receiveBase(result, "sayHello"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "sayHello failed: unknown result"); + } + + @Override + public java.lang.String withDelay(int delay) throws org.apache.thrift.TException { + send_withDelay(delay); + return recv_withDelay(); + } + + public void send_withDelay(int delay) throws org.apache.thrift.TException { + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + sendBase("withDelay", args); + } + + public java.lang.String recv_withDelay() throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + receiveBase(result, "withDelay"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withDelay failed: unknown result"); + } + + @Override + public java.lang.String withoutArgs() throws org.apache.thrift.TException { + send_withoutArgs(); + return recv_withoutArgs(); + } + + public void send_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_args args = new withoutArgs_args(); + sendBase("withoutArgs", args); + } + + public java.lang.String recv_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + receiveBase(result, "withoutArgs"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withoutArgs failed: unknown result"); + } + + @Override + public java.lang.String withError() throws org.apache.thrift.TException { + send_withError(); + return recv_withError(); + } + + public void send_withError() throws org.apache.thrift.TException { + withError_args args = new withError_args(); + sendBase("withError", args); + } + + public java.lang.String recv_withError() throws org.apache.thrift.TException { + withError_result result = new withError_result(); + receiveBase(result, "withError"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withError failed: unknown result"); + } + + @Override + public java.lang.String withCollisioin(java.lang.String input) + throws org.apache.thrift.TException { + send_withCollisioin(input); + return recv_withCollisioin(); + } + + public void send_withCollisioin(java.lang.String input) throws org.apache.thrift.TException { + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + sendBase("withCollisioin", args); + } + + public java.lang.String recv_withCollisioin() throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + receiveBase(result, "withCollisioin"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withCollisioin failed: unknown result"); + } + + @Override + public void noReturn(int delay) throws org.apache.thrift.TException { + send_noReturn(delay); + recv_noReturn(); + } + + public void send_noReturn(int delay) throws org.apache.thrift.TException { + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + sendBase("noReturn", args); + } + + public void recv_noReturn() throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + receiveBase(result, "noReturn"); + return; + } + + @Override + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException { + send_oneWayHasArgs(delay); + } + + public void send_oneWayHasArgs(int delay) throws org.apache.thrift.TException { + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + sendBaseOneway("oneWayHasArgs", args); + } + + @Override + public void oneWay() throws org.apache.thrift.TException { + send_oneWay(); + } + + public void send_oneWay() throws org.apache.thrift.TException { + oneWay_args args = new oneWay_args(); + sendBaseOneway("oneWay", args); + } + + @Override + public void oneWayWithError() throws org.apache.thrift.TException { + send_oneWayWithError(); + } + + public void send_oneWayWithError() throws org.apache.thrift.TException { + oneWayWithError_args args = new oneWayWithError_args(); + sendBaseOneway("oneWayWithError", args); + } + + @Override + public UserAccount data(User user, Account account) throws org.apache.thrift.TException { + send_data(user, account); + return recv_data(); + } + + public void send_data(User user, Account account) throws org.apache.thrift.TException { + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + sendBase("data", args); + } + + public UserAccount recv_data() throws org.apache.thrift.TException { + data_result result = new data_result(); + receiveBase(result, "data"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, "data failed: unknown result"); + } + } + + public static class AsyncClient extends org.apache.thrift.async.TAsyncClient + implements AsyncIface { + public static class Factory + implements org.apache.thrift.async.TAsyncClientFactory { + private org.apache.thrift.async.TAsyncClientManager clientManager; + private org.apache.thrift.protocol.TProtocolFactory protocolFactory; + + public Factory( + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.protocol.TProtocolFactory protocolFactory) { + this.clientManager = clientManager; + this.protocolFactory = protocolFactory; + } + + @Override + public AsyncClient getAsyncClient( + org.apache.thrift.transport.TNonblockingTransport transport) { + return new AsyncClient(protocolFactory, clientManager, transport); + } + } + + public AsyncClient( + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.transport.TNonblockingTransport transport) { + super(protocolFactory, clientManager, transport); + } + + @Override + public void sayHello( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + sayHello_call method_call = + new sayHello_call(zone, name, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class sayHello_call + extends org.apache.thrift.async.TAsyncMethodCall { + private java.lang.String zone; + private java.lang.String name; + + public sayHello_call( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.zone = zone; + this.name = name; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "sayHello", org.apache.thrift.protocol.TMessageType.CALL, 0)); + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_sayHello(); + } + } + + @Override + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withDelay_call method_call = + new withDelay_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withDelay_call + extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public withDelay_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withDelay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withDelay(); + } + } + + @Override + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withoutArgs_call method_call = + new withoutArgs_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withoutArgs_call + extends org.apache.thrift.async.TAsyncMethodCall { + public withoutArgs_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withoutArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withoutArgs_args args = new withoutArgs_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withoutArgs(); + } + } + + @Override + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withError_call method_call = + new withError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withError_call + extends org.apache.thrift.async.TAsyncMethodCall { + public withError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withError_args args = new withError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withError(); + } + } + + @Override + public void withCollisioin( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withCollisioin_call method_call = + new withCollisioin_call(input, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withCollisioin_call + extends org.apache.thrift.async.TAsyncMethodCall { + private java.lang.String input; + + public withCollisioin_call( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.input = input; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withCollisioin", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withCollisioin(); + } + } + + @Override + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + noReturn_call method_call = + new noReturn_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class noReturn_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public noReturn_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "noReturn", org.apache.thrift.protocol.TMessageType.CALL, 0)); + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + (new Client(prot)).recv_noReturn(); + return null; + } + } + + @Override + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayHasArgs_call method_call = + new oneWayHasArgs_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayHasArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public oneWayHasArgs_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + this.delay = delay; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayHasArgs", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + @Override + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWay_call method_call = + new oneWay_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWay_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWay_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWay", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWay_args args = new oneWay_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + @Override + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayWithError_call method_call = + new oneWayWithError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayWithError_call + extends org.apache.thrift.async.TAsyncMethodCall { + public oneWayWithError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayWithError", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayWithError_args args = new oneWayWithError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + @Override + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + data_call method_call = + new data_call(user, account, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class data_call extends org.apache.thrift.async.TAsyncMethodCall { + private User user; + private Account account; + + public data_call( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.user = user; + this.account = account; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "data", org.apache.thrift.protocol.TMessageType.CALL, 0)); + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public UserAccount getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_data(); + } + } + } + + public static class Processor extends org.apache.thrift.TBaseProcessor + implements org.apache.thrift.TProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(Processor.class.getName()); + + public Processor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + java.lang.String, + org.apache.thrift.ProcessFunction>())); + } + + protected Processor( + I iface, + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + getProcessMap( + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.ProcessFunction { + public sayHello() { + super("sayHello"); + } + + @Override + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public sayHello_result getResult(I iface, sayHello_args args) + throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + result.success = iface.sayHello(args.zone, args.name); + return result; + } + } + + public static class withDelay + extends org.apache.thrift.ProcessFunction { + public withDelay() { + super("withDelay"); + } + + @Override + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public withDelay_result getResult(I iface, withDelay_args args) + throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + result.success = iface.withDelay(args.delay); + return result; + } + } + + public static class withoutArgs + extends org.apache.thrift.ProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + @Override + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public withoutArgs_result getResult(I iface, withoutArgs_args args) + throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + result.success = iface.withoutArgs(); + return result; + } + } + + public static class withError + extends org.apache.thrift.ProcessFunction { + public withError() { + super("withError"); + } + + @Override + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public withError_result getResult(I iface, withError_args args) + throws org.apache.thrift.TException { + withError_result result = new withError_result(); + result.success = iface.withError(); + return result; + } + } + + public static class withCollisioin + extends org.apache.thrift.ProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + @Override + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public withCollisioin_result getResult(I iface, withCollisioin_args args) + throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + result.success = iface.withCollisioin(args.input); + return result; + } + } + + public static class noReturn + extends org.apache.thrift.ProcessFunction { + public noReturn() { + super("noReturn"); + } + + @Override + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public noReturn_result getResult(I iface, noReturn_args args) + throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + iface.noReturn(args.delay); + return result; + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.ProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + @Override + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + @Override + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public org.apache.thrift.TBase getResult(I iface, oneWayHasArgs_args args) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay); + return null; + } + } + + public static class oneWay + extends org.apache.thrift.ProcessFunction { + public oneWay() { + super("oneWay"); + } + + @Override + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + @Override + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public org.apache.thrift.TBase getResult(I iface, oneWay_args args) + throws org.apache.thrift.TException { + iface.oneWay(); + return null; + } + } + + public static class oneWayWithError + extends org.apache.thrift.ProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + @Override + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + @Override + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public org.apache.thrift.TBase getResult(I iface, oneWayWithError_args args) + throws org.apache.thrift.TException { + iface.oneWayWithError(); + return null; + } + } + + public static class data + extends org.apache.thrift.ProcessFunction { + public data() { + super("data"); + } + + @Override + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public data_result getResult(I iface, data_args args) throws org.apache.thrift.TException { + data_result result = new data_result(); + result.success = iface.data(args.user, args.account); + return result; + } + } + } + + public static class AsyncProcessor + extends org.apache.thrift.TBaseAsyncProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(AsyncProcessor.class.getName()); + + public AsyncProcessor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>>())); + } + + protected AsyncProcessor( + I iface, + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction> + getProcessMap( + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.AsyncProcessFunction { + public sayHello() { + super("sayHello"); + } + + @Override + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(java.lang.String o) { + sayHello_result result = new sayHello_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + sayHello_result result = new sayHello_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + sayHello_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.sayHello(args.zone, args.name, resultHandler); + } + } + + public static class withDelay + extends org.apache.thrift.AsyncProcessFunction { + public withDelay() { + super("withDelay"); + } + + @Override + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(java.lang.String o) { + withDelay_result result = new withDelay_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withDelay_result result = new withDelay_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + withDelay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withDelay(args.delay, resultHandler); + } + } + + public static class withoutArgs + extends org.apache.thrift.AsyncProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + @Override + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(java.lang.String o) { + withoutArgs_result result = new withoutArgs_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withoutArgs_result result = new withoutArgs_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + withoutArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withoutArgs(resultHandler); + } + } + + public static class withError + extends org.apache.thrift.AsyncProcessFunction { + public withError() { + super("withError"); + } + + @Override + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(java.lang.String o) { + withError_result result = new withError_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withError_result result = new withError_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + withError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withError(resultHandler); + } + } + + public static class withCollisioin + extends org.apache.thrift.AsyncProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + @Override + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(java.lang.String o) { + withCollisioin_result result = new withCollisioin_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withCollisioin_result result = new withCollisioin_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + withCollisioin_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withCollisioin(args.input, resultHandler); + } + } + + public static class noReturn + extends org.apache.thrift.AsyncProcessFunction { + public noReturn() { + super("noReturn"); + } + + @Override + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(Void o) { + noReturn_result result = new noReturn_result(); + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + noReturn_result result = new noReturn_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + noReturn_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.noReturn(args.delay, resultHandler); + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.AsyncProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + @Override + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(Void o) {} + + @Override + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + @Override + protected boolean isOneway() { + return true; + } + + @Override + public void start( + I iface, + oneWayHasArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay, resultHandler); + } + } + + public static class oneWay + extends org.apache.thrift.AsyncProcessFunction { + public oneWay() { + super("oneWay"); + } + + @Override + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(Void o) {} + + @Override + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + @Override + protected boolean isOneway() { + return true; + } + + @Override + public void start( + I iface, + oneWay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWay(resultHandler); + } + } + + public static class oneWayWithError + extends org.apache.thrift.AsyncProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + @Override + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(Void o) {} + + @Override + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + @Override + protected boolean isOneway() { + return true; + } + + @Override + public void start( + I iface, + oneWayWithError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayWithError(resultHandler); + } + } + + public static class data + extends org.apache.thrift.AsyncProcessFunction { + public data() { + super("data"); + } + + @Override + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(UserAccount o) { + data_result result = new data_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + data_result result = new data_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + data_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.data(args.user, args.account, resultHandler); + } + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class sayHello_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_args"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String zone; // required + public @org.apache.thrift.annotation.Nullable java.lang.String name; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + NAME((short) 2, "name"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // NAME + return NAME; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_args.class, metaDataMap); + } + + public sayHello_args() {} + + public sayHello_args(java.lang.String zone, java.lang.String name) { + this(); + this.zone = zone; + this.name = name; + } + + /** Performs a deep copy on other. */ + public sayHello_args(sayHello_args other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetName()) { + this.name = other.name; + } + } + + @Override + public sayHello_args deepCopy() { + return new sayHello_args(this); + } + + @Override + public void clear() { + this.zone = null; + this.name = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getZone() { + return this.zone; + } + + public sayHello_args setZone(@org.apache.thrift.annotation.Nullable java.lang.String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getName() { + return this.name; + } + + public sayHello_args setName(@org.apache.thrift.annotation.Nullable java.lang.String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((java.lang.String) value); + } + break; + + case NAME: + if (value == null) { + unsetName(); + } else { + setName((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case NAME: + return getName(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case NAME: + return isSetName(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof sayHello_args) return this.equals((sayHello_args) that); + return false; + } + + public boolean equals(sayHello_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetZone(), other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetName(), other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("sayHello_args("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public sayHello_argsStandardScheme getScheme() { + return new sayHello_argsStandardScheme(); + } + } + + private static class sayHello_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public sayHello_argsTupleScheme getScheme() { + return new sayHello_argsTupleScheme(); + } + } + + private static class sayHello_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetZone()) { + optionals.set(0); + } + if (struct.isSetName()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetZone()) { + oprot.writeString(struct.zone); + } + if (struct.isSetName()) { + oprot.writeString(struct.name); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } + if (incoming.get(1)) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class sayHello_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_result.class, metaDataMap); + } + + public sayHello_result() {} + + public sayHello_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public sayHello_result(sayHello_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + @Override + public sayHello_result deepCopy() { + return new sayHello_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public sayHello_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof sayHello_result) return this.equals((sayHello_result) that); + return false; + } + + public boolean equals(sayHello_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("sayHello_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public sayHello_resultStandardScheme getScheme() { + return new sayHello_resultStandardScheme(); + } + } + + private static class sayHello_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public sayHello_resultTupleScheme getScheme() { + return new sayHello_resultTupleScheme(); + } + } + + private static class sayHello_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withDelay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_args.class, metaDataMap); + } + + public withDelay_args() {} + + public withDelay_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public withDelay_args(withDelay_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + @Override + public withDelay_args deepCopy() { + return new withDelay_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public withDelay_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withDelay_args) return this.equals((withDelay_args) that); + return false; + } + + public boolean equals(withDelay_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(withDelay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withDelay_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withDelay_argsStandardScheme getScheme() { + return new withDelay_argsStandardScheme(); + } + } + + private static class withDelay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withDelay_argsTupleScheme getScheme() { + return new withDelay_argsTupleScheme(); + } + } + + private static class withDelay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withDelay_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_result.class, metaDataMap); + } + + public withDelay_result() {} + + public withDelay_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withDelay_result(withDelay_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + @Override + public withDelay_result deepCopy() { + return new withDelay_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withDelay_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withDelay_result) return this.equals((withDelay_result) that); + return false; + } + + public boolean equals(withDelay_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withDelay_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withDelay_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withDelay_resultStandardScheme getScheme() { + return new withDelay_resultStandardScheme(); + } + } + + private static class withDelay_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withDelay_resultTupleScheme getScheme() { + return new withDelay_resultTupleScheme(); + } + } + + private static class withDelay_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withoutArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_args.class, metaDataMap); + } + + public withoutArgs_args() {} + + /** Performs a deep copy on other. */ + public withoutArgs_args(withoutArgs_args other) {} + + @Override + public withoutArgs_args deepCopy() { + return new withoutArgs_args(this); + } + + @Override + public void clear() {} + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withoutArgs_args) return this.equals((withoutArgs_args) that); + return false; + } + + public boolean equals(withoutArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withoutArgs_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withoutArgs_argsStandardScheme getScheme() { + return new withoutArgs_argsStandardScheme(); + } + } + + private static class withoutArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withoutArgs_argsTupleScheme getScheme() { + return new withoutArgs_argsTupleScheme(); + } + } + + private static class withoutArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withoutArgs_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_result.class, metaDataMap); + } + + public withoutArgs_result() {} + + public withoutArgs_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withoutArgs_result(withoutArgs_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + @Override + public withoutArgs_result deepCopy() { + return new withoutArgs_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withoutArgs_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withoutArgs_result) return this.equals((withoutArgs_result) that); + return false; + } + + public boolean equals(withoutArgs_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withoutArgs_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withoutArgs_resultStandardScheme getScheme() { + return new withoutArgs_resultStandardScheme(); + } + } + + private static class withoutArgs_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withoutArgs_resultTupleScheme getScheme() { + return new withoutArgs_resultTupleScheme(); + } + } + + private static class withoutArgs_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_args.class, metaDataMap); + } + + public withError_args() {} + + /** Performs a deep copy on other. */ + public withError_args(withError_args other) {} + + @Override + public withError_args deepCopy() { + return new withError_args(this); + } + + @Override + public void clear() {} + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withError_args) return this.equals((withError_args) that); + return false; + } + + public boolean equals(withError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withError_argsStandardScheme getScheme() { + return new withError_argsStandardScheme(); + } + } + + private static class withError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withError_argsTupleScheme getScheme() { + return new withError_argsTupleScheme(); + } + } + + private static class withError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withError_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_result.class, metaDataMap); + } + + public withError_result() {} + + public withError_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withError_result(withError_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + @Override + public withError_result deepCopy() { + return new withError_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withError_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withError_result) return this.equals((withError_result) that); + return false; + } + + public boolean equals(withError_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withError_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withError_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withError_resultStandardScheme getScheme() { + return new withError_resultStandardScheme(); + } + } + + private static class withError_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withError_resultTupleScheme getScheme() { + return new withError_resultTupleScheme(); + } + } + + private static class withError_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withCollisioin_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_args"); + + private static final org.apache.thrift.protocol.TField INPUT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "input", org.apache.thrift.protocol.TType.STRING, (short) 3333); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String input; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + INPUT((short) 3333, "input"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 3333: // INPUT + return INPUT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.INPUT, + new org.apache.thrift.meta_data.FieldMetaData( + "input", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_args.class, metaDataMap); + } + + public withCollisioin_args() {} + + public withCollisioin_args(java.lang.String input) { + this(); + this.input = input; + } + + /** Performs a deep copy on other. */ + public withCollisioin_args(withCollisioin_args other) { + if (other.isSetInput()) { + this.input = other.input; + } + } + + @Override + public withCollisioin_args deepCopy() { + return new withCollisioin_args(this); + } + + @Override + public void clear() { + this.input = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getInput() { + return this.input; + } + + public withCollisioin_args setInput( + @org.apache.thrift.annotation.Nullable java.lang.String input) { + this.input = input; + return this; + } + + public void unsetInput() { + this.input = null; + } + + /** Returns true if field input is set (has been assigned a value) and false otherwise */ + public boolean isSetInput() { + return this.input != null; + } + + public void setInputIsSet(boolean value) { + if (!value) { + this.input = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case INPUT: + if (value == null) { + unsetInput(); + } else { + setInput((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case INPUT: + return getInput(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case INPUT: + return isSetInput(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withCollisioin_args) return this.equals((withCollisioin_args) that); + return false; + } + + public boolean equals(withCollisioin_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_input = true && this.isSetInput(); + boolean that_present_input = true && that.isSetInput(); + if (this_present_input || that_present_input) { + if (!(this_present_input && that_present_input)) return false; + if (!this.input.equals(that.input)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetInput()) ? 131071 : 524287); + if (isSetInput()) hashCode = hashCode * 8191 + input.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetInput(), other.isSetInput()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInput()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.input, other.input); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withCollisioin_args("); + boolean first = true; + + sb.append("input:"); + if (this.input == null) { + sb.append("null"); + } else { + sb.append(this.input); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withCollisioin_argsStandardScheme getScheme() { + return new withCollisioin_argsStandardScheme(); + } + } + + private static class withCollisioin_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 3333: // INPUT + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.input != null) { + oprot.writeFieldBegin(INPUT_FIELD_DESC); + oprot.writeString(struct.input); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withCollisioin_argsTupleScheme getScheme() { + return new withCollisioin_argsTupleScheme(); + } + } + + private static class withCollisioin_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetInput()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetInput()) { + oprot.writeString(struct.input); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withCollisioin_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_result.class, metaDataMap); + } + + public withCollisioin_result() {} + + public withCollisioin_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withCollisioin_result(withCollisioin_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + @Override + public withCollisioin_result deepCopy() { + return new withCollisioin_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withCollisioin_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withCollisioin_result) return this.equals((withCollisioin_result) that); + return false; + } + + public boolean equals(withCollisioin_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withCollisioin_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withCollisioin_resultStandardScheme getScheme() { + return new withCollisioin_resultStandardScheme(); + } + } + + private static class withCollisioin_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withCollisioin_resultTupleScheme getScheme() { + return new withCollisioin_resultTupleScheme(); + } + } + + private static class withCollisioin_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class noReturn_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_args.class, metaDataMap); + } + + public noReturn_args() {} + + public noReturn_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public noReturn_args(noReturn_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + @Override + public noReturn_args deepCopy() { + return new noReturn_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public noReturn_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof noReturn_args) return this.equals((noReturn_args) that); + return false; + } + + public boolean equals(noReturn_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(noReturn_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("noReturn_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public noReturn_argsStandardScheme getScheme() { + return new noReturn_argsStandardScheme(); + } + } + + private static class noReturn_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public noReturn_argsTupleScheme getScheme() { + return new noReturn_argsTupleScheme(); + } + } + + private static class noReturn_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class noReturn_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_result"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_resultTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_result.class, metaDataMap); + } + + public noReturn_result() {} + + /** Performs a deep copy on other. */ + public noReturn_result(noReturn_result other) {} + + @Override + public noReturn_result deepCopy() { + return new noReturn_result(this); + } + + @Override + public void clear() {} + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof noReturn_result) return this.equals((noReturn_result) that); + return false; + } + + public boolean equals(noReturn_result that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(noReturn_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("noReturn_result("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public noReturn_resultStandardScheme getScheme() { + return new noReturn_resultStandardScheme(); + } + } + + private static class noReturn_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public noReturn_resultTupleScheme getScheme() { + return new noReturn_resultTupleScheme(); + } + } + + private static class noReturn_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class oneWayHasArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayHasArgs_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayHasArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayHasArgs_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayHasArgs_args.class, metaDataMap); + } + + public oneWayHasArgs_args() {} + + public oneWayHasArgs_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public oneWayHasArgs_args(oneWayHasArgs_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + @Override + public oneWayHasArgs_args deepCopy() { + return new oneWayHasArgs_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public oneWayHasArgs_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWayHasArgs_args) return this.equals((oneWayHasArgs_args) that); + return false; + } + + public boolean equals(oneWayHasArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(oneWayHasArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWayHasArgs_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayHasArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWayHasArgs_argsStandardScheme getScheme() { + return new oneWayHasArgs_argsStandardScheme(); + } + } + + private static class oneWayHasArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayHasArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWayHasArgs_argsTupleScheme getScheme() { + return new oneWayHasArgs_argsTupleScheme(); + } + } + + private static class oneWayHasArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class oneWay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWay_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWay_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWay_args.class, metaDataMap); + } + + public oneWay_args() {} + + /** Performs a deep copy on other. */ + public oneWay_args(oneWay_args other) {} + + @Override + public oneWay_args deepCopy() { + return new oneWay_args(this); + } + + @Override + public void clear() {} + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWay_args) return this.equals((oneWay_args) that); + return false; + } + + public boolean equals(oneWay_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWay_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWay_argsStandardScheme getScheme() { + return new oneWay_argsStandardScheme(); + } + } + + private static class oneWay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWay_argsTupleScheme getScheme() { + return new oneWay_argsTupleScheme(); + } + } + + private static class oneWay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class oneWayWithError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayWithError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayWithError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayWithError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayWithError_args.class, metaDataMap); + } + + public oneWayWithError_args() {} + + /** Performs a deep copy on other. */ + public oneWayWithError_args(oneWayWithError_args other) {} + + @Override + public oneWayWithError_args deepCopy() { + return new oneWayWithError_args(this); + } + + @Override + public void clear() {} + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWayWithError_args) return this.equals((oneWayWithError_args) that); + return false; + } + + public boolean equals(oneWayWithError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWayWithError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWayWithError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayWithError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWayWithError_argsStandardScheme getScheme() { + return new oneWayWithError_argsStandardScheme(); + } + } + + private static class oneWayWithError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayWithError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWayWithError_argsTupleScheme getScheme() { + return new oneWayWithError_argsTupleScheme(); + } + } + + private static class oneWayWithError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class data_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_args"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable User user; // required + public @org.apache.thrift.annotation.Nullable Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(data_args.class, metaDataMap); + } + + public data_args() {} + + public data_args(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public data_args(data_args other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + @Override + public data_args deepCopy() { + return new data_args(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + @org.apache.thrift.annotation.Nullable + public User getUser() { + return this.user; + } + + public data_args setUser(@org.apache.thrift.annotation.Nullable User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + @org.apache.thrift.annotation.Nullable + public Account getAccount() { + return this.account; + } + + public data_args setAccount(@org.apache.thrift.annotation.Nullable Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof data_args) return this.equals((data_args) that); + return false; + } + + public boolean equals(data_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetUser(), other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAccount(), other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("data_args("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public data_argsStandardScheme getScheme() { + return new data_argsStandardScheme(); + } + } + + private static class data_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, data_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public data_argsTupleScheme getScheme() { + return new data_argsTupleScheme(); + } + } + + private static class data_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetUser()) { + optionals.set(0); + } + if (struct.isSetAccount()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetUser()) { + struct.user.write(oprot); + } + if (struct.isSetAccount()) { + struct.account.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } + if (incoming.get(1)) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class data_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRUCT, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable UserAccount success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, UserAccount.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + data_result.class, metaDataMap); + } + + public data_result() {} + + public data_result(UserAccount success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public data_result(data_result other) { + if (other.isSetSuccess()) { + this.success = new UserAccount(other.success); + } + } + + @Override + public data_result deepCopy() { + return new data_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public UserAccount getSuccess() { + return this.success; + } + + public data_result setSuccess(@org.apache.thrift.annotation.Nullable UserAccount success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((UserAccount) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof data_result) return this.equals((data_result) that); + return false; + } + + public boolean equals(data_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("data_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public data_resultStandardScheme getScheme() { + return new data_resultStandardScheme(); + } + } + + private static class data_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, data_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public data_resultTupleScheme getScheme() { + return new data_resultTupleScheme(); + } + } + + private static class data_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_19_0/User.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_19_0/User.java new file mode 100644 index 000000000000..bccd3c937522 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_19_0/User.java @@ -0,0 +1,609 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_19_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.19.0)", + date = "2025-02-27") +public class User + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("User"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "userId", org.apache.thrift.protocol.TType.STRING, (short) 2); + private static final org.apache.thrift.protocol.TField AGE_FIELD_DESC = + new org.apache.thrift.protocol.TField("age", org.apache.thrift.protocol.TType.I32, (short) 3); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String name; // required + public @org.apache.thrift.annotation.Nullable java.lang.String userId; // required + public int age; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + NAME((short) 1, "name"), + USER_ID((short) 2, "userId"), + AGE((short) 3, "age"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // NAME + return NAME; + case 2: // USER_ID + return USER_ID; + case 3: // AGE + return AGE; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __AGE_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.USER_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "userId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.AGE, + new org.apache.thrift.meta_data.FieldMetaData( + "age", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(User.class, metaDataMap); + } + + public User() {} + + public User(java.lang.String name, java.lang.String userId, int age) { + this(); + this.name = name; + this.userId = userId; + this.age = age; + setAgeIsSet(true); + } + + /** Performs a deep copy on other. */ + public User(User other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetName()) { + this.name = other.name; + } + if (other.isSetUserId()) { + this.userId = other.userId; + } + this.age = other.age; + } + + @Override + public User deepCopy() { + return new User(this); + } + + @Override + public void clear() { + this.name = null; + this.userId = null; + setAgeIsSet(false); + this.age = 0; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getName() { + return this.name; + } + + public User setName(@org.apache.thrift.annotation.Nullable java.lang.String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getUserId() { + return this.userId; + } + + public User setUserId(@org.apache.thrift.annotation.Nullable java.lang.String userId) { + this.userId = userId; + return this; + } + + public void unsetUserId() { + this.userId = null; + } + + /** Returns true if field userId is set (has been assigned a value) and false otherwise */ + public boolean isSetUserId() { + return this.userId != null; + } + + public void setUserIdIsSet(boolean value) { + if (!value) { + this.userId = null; + } + } + + public int getAge() { + return this.age; + } + + public User setAge(int age) { + this.age = age; + setAgeIsSet(true); + return this; + } + + public void unsetAge() { + __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __AGE_ISSET_ID); + } + + /** Returns true if field age is set (has been assigned a value) and false otherwise */ + public boolean isSetAge() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __AGE_ISSET_ID); + } + + public void setAgeIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __AGE_ISSET_ID, value); + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case NAME: + if (value == null) { + unsetName(); + } else { + setName((java.lang.String) value); + } + break; + + case USER_ID: + if (value == null) { + unsetUserId(); + } else { + setUserId((java.lang.String) value); + } + break; + + case AGE: + if (value == null) { + unsetAge(); + } else { + setAge((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case NAME: + return getName(); + + case USER_ID: + return getUserId(); + + case AGE: + return getAge(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case NAME: + return isSetName(); + case USER_ID: + return isSetUserId(); + case AGE: + return isSetAge(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof User) return this.equals((User) that); + return false; + } + + public boolean equals(User that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + boolean this_present_userId = true && this.isSetUserId(); + boolean that_present_userId = true && that.isSetUserId(); + if (this_present_userId || that_present_userId) { + if (!(this_present_userId && that_present_userId)) return false; + if (!this.userId.equals(that.userId)) return false; + } + + boolean this_present_age = true; + boolean that_present_age = true; + if (this_present_age || that_present_age) { + if (!(this_present_age && that_present_age)) return false; + if (this.age != that.age) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + hashCode = hashCode * 8191 + ((isSetUserId()) ? 131071 : 524287); + if (isSetUserId()) hashCode = hashCode * 8191 + userId.hashCode(); + + hashCode = hashCode * 8191 + age; + + return hashCode; + } + + @Override + public int compareTo(User other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetName(), other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetUserId(), other.isSetUserId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAge(), other.isSetAge()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAge()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.age, other.age); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("User("); + boolean first = true; + + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + if (!first) sb.append(", "); + sb.append("userId:"); + if (this.userId == null) { + sb.append("null"); + } else { + sb.append(this.userId); + } + first = false; + if (!first) sb.append(", "); + sb.append("age:"); + sb.append(this.age); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (name == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'name' was not present! Struct: " + toString()); + } + if (userId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'userId' was not present! Struct: " + toString()); + } + // alas, we cannot check 'age' because it's a primitive and you chose the non-beans generator. + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + @Override + public UserStandardScheme getScheme() { + return new UserStandardScheme(); + } + } + + private static class UserStandardScheme extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // AGE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + if (!struct.isSetAge()) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'age' was not found in serialized data! Struct: " + toString()); + } + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, User struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + if (struct.userId != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userId); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(AGE_FIELD_DESC); + oprot.writeI32(struct.age); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + @Override + public UserTupleScheme getScheme() { + return new UserTupleScheme(); + } + } + + private static class UserTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.name); + oprot.writeString(struct.userId); + oprot.writeI32(struct.age); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.name = iprot.readString(); + struct.setNameIsSet(true); + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_19_0/UserAccount.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_19_0/UserAccount.java new file mode 100644 index 000000000000..3b9399e43c4e --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_19_0/UserAccount.java @@ -0,0 +1,520 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_19_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.19.0)", + date = "2025-02-27") +public class UserAccount + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("UserAccount"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserAccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserAccountTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable User user; // required + public @org.apache.thrift.annotation.Nullable Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserAccount.class, metaDataMap); + } + + public UserAccount() {} + + public UserAccount(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public UserAccount(UserAccount other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + @Override + public UserAccount deepCopy() { + return new UserAccount(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + @org.apache.thrift.annotation.Nullable + public User getUser() { + return this.user; + } + + public UserAccount setUser(@org.apache.thrift.annotation.Nullable User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + @org.apache.thrift.annotation.Nullable + public Account getAccount() { + return this.account; + } + + public UserAccount setAccount(@org.apache.thrift.annotation.Nullable Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof UserAccount) return this.equals((UserAccount) that); + return false; + } + + public boolean equals(UserAccount that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(UserAccount other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetUser(), other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAccount(), other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("UserAccount("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (user == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'user' was not present! Struct: " + toString()); + } + if (account == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'account' was not present! Struct: " + toString()); + } + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserAccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public UserAccountStandardScheme getScheme() { + return new UserAccountStandardScheme(); + } + } + + private static class UserAccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, UserAccount struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserAccountTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public UserAccountTupleScheme getScheme() { + return new UserAccountTupleScheme(); + } + } + + private static class UserAccountTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user.write(oprot); + struct.account.write(oprot); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_20_0/Account.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_20_0/Account.java new file mode 100644 index 000000000000..24e14432b72d --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_20_0/Account.java @@ -0,0 +1,508 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_20_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.20.0)", + date = "2025-02-27") +public class Account + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("Account"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField CARD_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "cardId", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new AccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new AccountTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String zone; // required + public @org.apache.thrift.annotation.Nullable java.lang.String cardId; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + CARD_ID((short) 2, "cardId"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // CARD_ID + return CARD_ID; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.CARD_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "cardId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Account.class, metaDataMap); + } + + public Account() {} + + public Account(java.lang.String zone, java.lang.String cardId) { + this(); + this.zone = zone; + this.cardId = cardId; + } + + /** Performs a deep copy on other. */ + public Account(Account other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetCardId()) { + this.cardId = other.cardId; + } + } + + @Override + public Account deepCopy() { + return new Account(this); + } + + @Override + public void clear() { + this.zone = null; + this.cardId = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getZone() { + return this.zone; + } + + public Account setZone(@org.apache.thrift.annotation.Nullable java.lang.String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getCardId() { + return this.cardId; + } + + public Account setCardId(@org.apache.thrift.annotation.Nullable java.lang.String cardId) { + this.cardId = cardId; + return this; + } + + public void unsetCardId() { + this.cardId = null; + } + + /** Returns true if field cardId is set (has been assigned a value) and false otherwise */ + public boolean isSetCardId() { + return this.cardId != null; + } + + public void setCardIdIsSet(boolean value) { + if (!value) { + this.cardId = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((java.lang.String) value); + } + break; + + case CARD_ID: + if (value == null) { + unsetCardId(); + } else { + setCardId((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case CARD_ID: + return getCardId(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case CARD_ID: + return isSetCardId(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof Account) return this.equals((Account) that); + return false; + } + + public boolean equals(Account that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_cardId = true && this.isSetCardId(); + boolean that_present_cardId = true && that.isSetCardId(); + if (this_present_cardId || that_present_cardId) { + if (!(this_present_cardId && that_present_cardId)) return false; + if (!this.cardId.equals(that.cardId)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetCardId()) ? 131071 : 524287); + if (isSetCardId()) hashCode = hashCode * 8191 + cardId.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(Account other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetZone(), other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetCardId(), other.isSetCardId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCardId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cardId, other.cardId); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("Account("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("cardId:"); + if (this.cardId == null) { + sb.append("null"); + } else { + sb.append(this.cardId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (zone == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'zone' was not present! Struct: " + toString()); + } + if (cardId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'cardId' was not present! Struct: " + toString()); + } + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class AccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public AccountStandardScheme getScheme() { + return new AccountStandardScheme(); + } + } + + private static class AccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // CARD_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, Account struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.cardId != null) { + oprot.writeFieldBegin(CARD_ID_FIELD_DESC); + oprot.writeString(struct.cardId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class AccountTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + @Override + public AccountTupleScheme getScheme() { + return new AccountTupleScheme(); + } + } + + private static class AccountTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.zone); + oprot.writeString(struct.cardId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_20_0/ThriftService.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_20_0/ThriftService.java new file mode 100644 index 000000000000..14343ed49293 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_20_0/ThriftService.java @@ -0,0 +1,8475 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_20_0; + +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.20.0)", + date = "2025-02-27") +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +public class ThriftService { + + public interface Iface { + + public java.lang.String sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException; + + public java.lang.String withDelay(int delay) throws org.apache.thrift.TException; + + public java.lang.String withoutArgs() throws org.apache.thrift.TException; + + public java.lang.String withError() throws org.apache.thrift.TException; + + public java.lang.String withCollisioin(java.lang.String input) + throws org.apache.thrift.TException; + + public void noReturn(int delay) throws org.apache.thrift.TException; + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException; + + public void oneWay() throws org.apache.thrift.TException; + + public void oneWayWithError() throws org.apache.thrift.TException; + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException; + } + + public interface AsyncIface { + + public void sayHello( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withCollisioin( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + } + + public static class Client extends org.apache.thrift.TServiceClient implements Iface { + public static class Factory implements org.apache.thrift.TServiceClientFactory { + public Factory() {} + + @Override + public Client getClient(org.apache.thrift.protocol.TProtocol prot) { + return new Client(prot); + } + + @Override + public Client getClient( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + return new Client(iprot, oprot); + } + } + + public Client(org.apache.thrift.protocol.TProtocol prot) { + super(prot, prot); + } + + public Client( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + super(iprot, oprot); + } + + @Override + public java.lang.String sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException { + send_sayHello(zone, name); + return recv_sayHello(); + } + + public void send_sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException { + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + sendBase("sayHello", args); + } + + public java.lang.String recv_sayHello() throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + receiveBase(result, "sayHello"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "sayHello failed: unknown result"); + } + + @Override + public java.lang.String withDelay(int delay) throws org.apache.thrift.TException { + send_withDelay(delay); + return recv_withDelay(); + } + + public void send_withDelay(int delay) throws org.apache.thrift.TException { + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + sendBase("withDelay", args); + } + + public java.lang.String recv_withDelay() throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + receiveBase(result, "withDelay"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withDelay failed: unknown result"); + } + + @Override + public java.lang.String withoutArgs() throws org.apache.thrift.TException { + send_withoutArgs(); + return recv_withoutArgs(); + } + + public void send_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_args args = new withoutArgs_args(); + sendBase("withoutArgs", args); + } + + public java.lang.String recv_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + receiveBase(result, "withoutArgs"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withoutArgs failed: unknown result"); + } + + @Override + public java.lang.String withError() throws org.apache.thrift.TException { + send_withError(); + return recv_withError(); + } + + public void send_withError() throws org.apache.thrift.TException { + withError_args args = new withError_args(); + sendBase("withError", args); + } + + public java.lang.String recv_withError() throws org.apache.thrift.TException { + withError_result result = new withError_result(); + receiveBase(result, "withError"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withError failed: unknown result"); + } + + @Override + public java.lang.String withCollisioin(java.lang.String input) + throws org.apache.thrift.TException { + send_withCollisioin(input); + return recv_withCollisioin(); + } + + public void send_withCollisioin(java.lang.String input) throws org.apache.thrift.TException { + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + sendBase("withCollisioin", args); + } + + public java.lang.String recv_withCollisioin() throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + receiveBase(result, "withCollisioin"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withCollisioin failed: unknown result"); + } + + @Override + public void noReturn(int delay) throws org.apache.thrift.TException { + send_noReturn(delay); + recv_noReturn(); + } + + public void send_noReturn(int delay) throws org.apache.thrift.TException { + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + sendBase("noReturn", args); + } + + public void recv_noReturn() throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + receiveBase(result, "noReturn"); + return; + } + + @Override + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException { + send_oneWayHasArgs(delay); + } + + public void send_oneWayHasArgs(int delay) throws org.apache.thrift.TException { + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + sendBaseOneway("oneWayHasArgs", args); + } + + @Override + public void oneWay() throws org.apache.thrift.TException { + send_oneWay(); + } + + public void send_oneWay() throws org.apache.thrift.TException { + oneWay_args args = new oneWay_args(); + sendBaseOneway("oneWay", args); + } + + @Override + public void oneWayWithError() throws org.apache.thrift.TException { + send_oneWayWithError(); + } + + public void send_oneWayWithError() throws org.apache.thrift.TException { + oneWayWithError_args args = new oneWayWithError_args(); + sendBaseOneway("oneWayWithError", args); + } + + @Override + public UserAccount data(User user, Account account) throws org.apache.thrift.TException { + send_data(user, account); + return recv_data(); + } + + public void send_data(User user, Account account) throws org.apache.thrift.TException { + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + sendBase("data", args); + } + + public UserAccount recv_data() throws org.apache.thrift.TException { + data_result result = new data_result(); + receiveBase(result, "data"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, "data failed: unknown result"); + } + } + + public static class AsyncClient extends org.apache.thrift.async.TAsyncClient + implements AsyncIface { + public static class Factory + implements org.apache.thrift.async.TAsyncClientFactory { + private org.apache.thrift.async.TAsyncClientManager clientManager; + private org.apache.thrift.protocol.TProtocolFactory protocolFactory; + + public Factory( + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.protocol.TProtocolFactory protocolFactory) { + this.clientManager = clientManager; + this.protocolFactory = protocolFactory; + } + + @Override + public AsyncClient getAsyncClient( + org.apache.thrift.transport.TNonblockingTransport transport) { + return new AsyncClient(protocolFactory, clientManager, transport); + } + } + + public AsyncClient( + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.transport.TNonblockingTransport transport) { + super(protocolFactory, clientManager, transport); + } + + @Override + public void sayHello( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + sayHello_call method_call = + new sayHello_call(zone, name, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class sayHello_call + extends org.apache.thrift.async.TAsyncMethodCall { + private java.lang.String zone; + private java.lang.String name; + + public sayHello_call( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.zone = zone; + this.name = name; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "sayHello", org.apache.thrift.protocol.TMessageType.CALL, 0)); + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_sayHello(); + } + } + + @Override + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withDelay_call method_call = + new withDelay_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withDelay_call + extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public withDelay_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withDelay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withDelay(); + } + } + + @Override + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withoutArgs_call method_call = + new withoutArgs_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withoutArgs_call + extends org.apache.thrift.async.TAsyncMethodCall { + public withoutArgs_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withoutArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withoutArgs_args args = new withoutArgs_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withoutArgs(); + } + } + + @Override + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withError_call method_call = + new withError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withError_call + extends org.apache.thrift.async.TAsyncMethodCall { + public withError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withError_args args = new withError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withError(); + } + } + + @Override + public void withCollisioin( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withCollisioin_call method_call = + new withCollisioin_call(input, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withCollisioin_call + extends org.apache.thrift.async.TAsyncMethodCall { + private java.lang.String input; + + public withCollisioin_call( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.input = input; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withCollisioin", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withCollisioin(); + } + } + + @Override + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + noReturn_call method_call = + new noReturn_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class noReturn_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public noReturn_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "noReturn", org.apache.thrift.protocol.TMessageType.CALL, 0)); + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + (new Client(prot)).recv_noReturn(); + return null; + } + } + + @Override + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayHasArgs_call method_call = + new oneWayHasArgs_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayHasArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public oneWayHasArgs_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + this.delay = delay; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayHasArgs", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + @Override + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWay_call method_call = + new oneWay_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWay_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWay_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWay", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWay_args args = new oneWay_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + @Override + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayWithError_call method_call = + new oneWayWithError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayWithError_call + extends org.apache.thrift.async.TAsyncMethodCall { + public oneWayWithError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayWithError", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayWithError_args args = new oneWayWithError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + @Override + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + data_call method_call = + new data_call(user, account, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class data_call extends org.apache.thrift.async.TAsyncMethodCall { + private User user; + private Account account; + + public data_call( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.user = user; + this.account = account; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "data", org.apache.thrift.protocol.TMessageType.CALL, 0)); + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public UserAccount getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_data(); + } + } + } + + public static class Processor extends org.apache.thrift.TBaseProcessor + implements org.apache.thrift.TProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(Processor.class.getName()); + + public Processor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + java.lang.String, + org.apache.thrift.ProcessFunction>())); + } + + protected Processor( + I iface, + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + getProcessMap( + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.ProcessFunction { + public sayHello() { + super("sayHello"); + } + + @Override + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public sayHello_result getResult(I iface, sayHello_args args) + throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + result.success = iface.sayHello(args.zone, args.name); + return result; + } + } + + public static class withDelay + extends org.apache.thrift.ProcessFunction { + public withDelay() { + super("withDelay"); + } + + @Override + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public withDelay_result getResult(I iface, withDelay_args args) + throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + result.success = iface.withDelay(args.delay); + return result; + } + } + + public static class withoutArgs + extends org.apache.thrift.ProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + @Override + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public withoutArgs_result getResult(I iface, withoutArgs_args args) + throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + result.success = iface.withoutArgs(); + return result; + } + } + + public static class withError + extends org.apache.thrift.ProcessFunction { + public withError() { + super("withError"); + } + + @Override + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public withError_result getResult(I iface, withError_args args) + throws org.apache.thrift.TException { + withError_result result = new withError_result(); + result.success = iface.withError(); + return result; + } + } + + public static class withCollisioin + extends org.apache.thrift.ProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + @Override + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public withCollisioin_result getResult(I iface, withCollisioin_args args) + throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + result.success = iface.withCollisioin(args.input); + return result; + } + } + + public static class noReturn + extends org.apache.thrift.ProcessFunction { + public noReturn() { + super("noReturn"); + } + + @Override + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public noReturn_result getResult(I iface, noReturn_args args) + throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + iface.noReturn(args.delay); + return result; + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.ProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + @Override + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + @Override + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public org.apache.thrift.TBase getResult(I iface, oneWayHasArgs_args args) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay); + return null; + } + } + + public static class oneWay + extends org.apache.thrift.ProcessFunction { + public oneWay() { + super("oneWay"); + } + + @Override + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + @Override + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public org.apache.thrift.TBase getResult(I iface, oneWay_args args) + throws org.apache.thrift.TException { + iface.oneWay(); + return null; + } + } + + public static class oneWayWithError + extends org.apache.thrift.ProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + @Override + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + @Override + protected boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public org.apache.thrift.TBase getResult(I iface, oneWayWithError_args args) + throws org.apache.thrift.TException { + iface.oneWayWithError(); + return null; + } + } + + public static class data + extends org.apache.thrift.ProcessFunction { + public data() { + super("data"); + } + + @Override + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public data_result getResult(I iface, data_args args) throws org.apache.thrift.TException { + data_result result = new data_result(); + result.success = iface.data(args.user, args.account); + return result; + } + } + } + + public static class AsyncProcessor + extends org.apache.thrift.TBaseAsyncProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(AsyncProcessor.class.getName()); + + public AsyncProcessor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>>())); + } + + protected AsyncProcessor( + I iface, + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction> + getProcessMap( + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.AsyncProcessFunction { + public sayHello() { + super("sayHello"); + } + + @Override + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(java.lang.String o) { + sayHello_result result = new sayHello_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + sayHello_result result = new sayHello_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + sayHello_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.sayHello(args.zone, args.name, resultHandler); + } + } + + public static class withDelay + extends org.apache.thrift.AsyncProcessFunction { + public withDelay() { + super("withDelay"); + } + + @Override + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(java.lang.String o) { + withDelay_result result = new withDelay_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withDelay_result result = new withDelay_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + withDelay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withDelay(args.delay, resultHandler); + } + } + + public static class withoutArgs + extends org.apache.thrift.AsyncProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + @Override + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(java.lang.String o) { + withoutArgs_result result = new withoutArgs_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withoutArgs_result result = new withoutArgs_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + withoutArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withoutArgs(resultHandler); + } + } + + public static class withError + extends org.apache.thrift.AsyncProcessFunction { + public withError() { + super("withError"); + } + + @Override + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(java.lang.String o) { + withError_result result = new withError_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withError_result result = new withError_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + withError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withError(resultHandler); + } + } + + public static class withCollisioin + extends org.apache.thrift.AsyncProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + @Override + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(java.lang.String o) { + withCollisioin_result result = new withCollisioin_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withCollisioin_result result = new withCollisioin_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + withCollisioin_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withCollisioin(args.input, resultHandler); + } + } + + public static class noReturn + extends org.apache.thrift.AsyncProcessFunction { + public noReturn() { + super("noReturn"); + } + + @Override + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(Void o) { + noReturn_result result = new noReturn_result(); + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + noReturn_result result = new noReturn_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + noReturn_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.noReturn(args.delay, resultHandler); + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.AsyncProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + @Override + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(Void o) {} + + @Override + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + @Override + protected boolean isOneway() { + return true; + } + + @Override + public void start( + I iface, + oneWayHasArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay, resultHandler); + } + } + + public static class oneWay + extends org.apache.thrift.AsyncProcessFunction { + public oneWay() { + super("oneWay"); + } + + @Override + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(Void o) {} + + @Override + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + @Override + protected boolean isOneway() { + return true; + } + + @Override + public void start( + I iface, + oneWay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWay(resultHandler); + } + } + + public static class oneWayWithError + extends org.apache.thrift.AsyncProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + @Override + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(Void o) {} + + @Override + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + @Override + protected boolean isOneway() { + return true; + } + + @Override + public void start( + I iface, + oneWayWithError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayWithError(resultHandler); + } + } + + public static class data + extends org.apache.thrift.AsyncProcessFunction { + public data() { + super("data"); + } + + @Override + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(UserAccount o) { + data_result result = new data_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + data_result result = new data_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + protected boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + data_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.data(args.user, args.account, resultHandler); + } + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class sayHello_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_args"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String zone; // required + public @org.apache.thrift.annotation.Nullable java.lang.String name; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + NAME((short) 2, "name"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // NAME + return NAME; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_args.class, metaDataMap); + } + + public sayHello_args() {} + + public sayHello_args(java.lang.String zone, java.lang.String name) { + this(); + this.zone = zone; + this.name = name; + } + + /** Performs a deep copy on other. */ + public sayHello_args(sayHello_args other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetName()) { + this.name = other.name; + } + } + + @Override + public sayHello_args deepCopy() { + return new sayHello_args(this); + } + + @Override + public void clear() { + this.zone = null; + this.name = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getZone() { + return this.zone; + } + + public sayHello_args setZone(@org.apache.thrift.annotation.Nullable java.lang.String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getName() { + return this.name; + } + + public sayHello_args setName(@org.apache.thrift.annotation.Nullable java.lang.String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((java.lang.String) value); + } + break; + + case NAME: + if (value == null) { + unsetName(); + } else { + setName((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case NAME: + return getName(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case NAME: + return isSetName(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof sayHello_args) return this.equals((sayHello_args) that); + return false; + } + + public boolean equals(sayHello_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetZone(), other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetName(), other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("sayHello_args("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public sayHello_argsStandardScheme getScheme() { + return new sayHello_argsStandardScheme(); + } + } + + private static class sayHello_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public sayHello_argsTupleScheme getScheme() { + return new sayHello_argsTupleScheme(); + } + } + + private static class sayHello_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetZone()) { + optionals.set(0); + } + if (struct.isSetName()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetZone()) { + oprot.writeString(struct.zone); + } + if (struct.isSetName()) { + oprot.writeString(struct.name); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } + if (incoming.get(1)) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class sayHello_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_result.class, metaDataMap); + } + + public sayHello_result() {} + + public sayHello_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public sayHello_result(sayHello_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + @Override + public sayHello_result deepCopy() { + return new sayHello_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public sayHello_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof sayHello_result) return this.equals((sayHello_result) that); + return false; + } + + public boolean equals(sayHello_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("sayHello_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public sayHello_resultStandardScheme getScheme() { + return new sayHello_resultStandardScheme(); + } + } + + private static class sayHello_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public sayHello_resultTupleScheme getScheme() { + return new sayHello_resultTupleScheme(); + } + } + + private static class sayHello_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withDelay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_args.class, metaDataMap); + } + + public withDelay_args() {} + + public withDelay_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public withDelay_args(withDelay_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + @Override + public withDelay_args deepCopy() { + return new withDelay_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public withDelay_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withDelay_args) return this.equals((withDelay_args) that); + return false; + } + + public boolean equals(withDelay_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(withDelay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withDelay_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withDelay_argsStandardScheme getScheme() { + return new withDelay_argsStandardScheme(); + } + } + + private static class withDelay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withDelay_argsTupleScheme getScheme() { + return new withDelay_argsTupleScheme(); + } + } + + private static class withDelay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withDelay_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_result.class, metaDataMap); + } + + public withDelay_result() {} + + public withDelay_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withDelay_result(withDelay_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + @Override + public withDelay_result deepCopy() { + return new withDelay_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withDelay_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withDelay_result) return this.equals((withDelay_result) that); + return false; + } + + public boolean equals(withDelay_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withDelay_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withDelay_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withDelay_resultStandardScheme getScheme() { + return new withDelay_resultStandardScheme(); + } + } + + private static class withDelay_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withDelay_resultTupleScheme getScheme() { + return new withDelay_resultTupleScheme(); + } + } + + private static class withDelay_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withoutArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_args.class, metaDataMap); + } + + public withoutArgs_args() {} + + /** Performs a deep copy on other. */ + public withoutArgs_args(withoutArgs_args other) {} + + @Override + public withoutArgs_args deepCopy() { + return new withoutArgs_args(this); + } + + @Override + public void clear() {} + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withoutArgs_args) return this.equals((withoutArgs_args) that); + return false; + } + + public boolean equals(withoutArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withoutArgs_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withoutArgs_argsStandardScheme getScheme() { + return new withoutArgs_argsStandardScheme(); + } + } + + private static class withoutArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withoutArgs_argsTupleScheme getScheme() { + return new withoutArgs_argsTupleScheme(); + } + } + + private static class withoutArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withoutArgs_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_result.class, metaDataMap); + } + + public withoutArgs_result() {} + + public withoutArgs_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withoutArgs_result(withoutArgs_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + @Override + public withoutArgs_result deepCopy() { + return new withoutArgs_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withoutArgs_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withoutArgs_result) return this.equals((withoutArgs_result) that); + return false; + } + + public boolean equals(withoutArgs_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withoutArgs_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withoutArgs_resultStandardScheme getScheme() { + return new withoutArgs_resultStandardScheme(); + } + } + + private static class withoutArgs_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withoutArgs_resultTupleScheme getScheme() { + return new withoutArgs_resultTupleScheme(); + } + } + + private static class withoutArgs_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_args.class, metaDataMap); + } + + public withError_args() {} + + /** Performs a deep copy on other. */ + public withError_args(withError_args other) {} + + @Override + public withError_args deepCopy() { + return new withError_args(this); + } + + @Override + public void clear() {} + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withError_args) return this.equals((withError_args) that); + return false; + } + + public boolean equals(withError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withError_argsStandardScheme getScheme() { + return new withError_argsStandardScheme(); + } + } + + private static class withError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withError_argsTupleScheme getScheme() { + return new withError_argsTupleScheme(); + } + } + + private static class withError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withError_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_result.class, metaDataMap); + } + + public withError_result() {} + + public withError_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withError_result(withError_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + @Override + public withError_result deepCopy() { + return new withError_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withError_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withError_result) return this.equals((withError_result) that); + return false; + } + + public boolean equals(withError_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withError_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withError_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withError_resultStandardScheme getScheme() { + return new withError_resultStandardScheme(); + } + } + + private static class withError_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withError_resultTupleScheme getScheme() { + return new withError_resultTupleScheme(); + } + } + + private static class withError_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withCollisioin_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_args"); + + private static final org.apache.thrift.protocol.TField INPUT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "input", org.apache.thrift.protocol.TType.STRING, (short) 3333); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String input; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + INPUT((short) 3333, "input"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 3333: // INPUT + return INPUT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.INPUT, + new org.apache.thrift.meta_data.FieldMetaData( + "input", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_args.class, metaDataMap); + } + + public withCollisioin_args() {} + + public withCollisioin_args(java.lang.String input) { + this(); + this.input = input; + } + + /** Performs a deep copy on other. */ + public withCollisioin_args(withCollisioin_args other) { + if (other.isSetInput()) { + this.input = other.input; + } + } + + @Override + public withCollisioin_args deepCopy() { + return new withCollisioin_args(this); + } + + @Override + public void clear() { + this.input = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getInput() { + return this.input; + } + + public withCollisioin_args setInput( + @org.apache.thrift.annotation.Nullable java.lang.String input) { + this.input = input; + return this; + } + + public void unsetInput() { + this.input = null; + } + + /** Returns true if field input is set (has been assigned a value) and false otherwise */ + public boolean isSetInput() { + return this.input != null; + } + + public void setInputIsSet(boolean value) { + if (!value) { + this.input = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case INPUT: + if (value == null) { + unsetInput(); + } else { + setInput((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case INPUT: + return getInput(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case INPUT: + return isSetInput(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withCollisioin_args) return this.equals((withCollisioin_args) that); + return false; + } + + public boolean equals(withCollisioin_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_input = true && this.isSetInput(); + boolean that_present_input = true && that.isSetInput(); + if (this_present_input || that_present_input) { + if (!(this_present_input && that_present_input)) return false; + if (!this.input.equals(that.input)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetInput()) ? 131071 : 524287); + if (isSetInput()) hashCode = hashCode * 8191 + input.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetInput(), other.isSetInput()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInput()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.input, other.input); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withCollisioin_args("); + boolean first = true; + + sb.append("input:"); + if (this.input == null) { + sb.append("null"); + } else { + sb.append(this.input); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withCollisioin_argsStandardScheme getScheme() { + return new withCollisioin_argsStandardScheme(); + } + } + + private static class withCollisioin_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 3333: // INPUT + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.input != null) { + oprot.writeFieldBegin(INPUT_FIELD_DESC); + oprot.writeString(struct.input); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withCollisioin_argsTupleScheme getScheme() { + return new withCollisioin_argsTupleScheme(); + } + } + + private static class withCollisioin_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetInput()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetInput()) { + oprot.writeString(struct.input); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withCollisioin_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_result.class, metaDataMap); + } + + public withCollisioin_result() {} + + public withCollisioin_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withCollisioin_result(withCollisioin_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + @Override + public withCollisioin_result deepCopy() { + return new withCollisioin_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withCollisioin_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withCollisioin_result) return this.equals((withCollisioin_result) that); + return false; + } + + public boolean equals(withCollisioin_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withCollisioin_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withCollisioin_resultStandardScheme getScheme() { + return new withCollisioin_resultStandardScheme(); + } + } + + private static class withCollisioin_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withCollisioin_resultTupleScheme getScheme() { + return new withCollisioin_resultTupleScheme(); + } + } + + private static class withCollisioin_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class noReturn_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_args.class, metaDataMap); + } + + public noReturn_args() {} + + public noReturn_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public noReturn_args(noReturn_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + @Override + public noReturn_args deepCopy() { + return new noReturn_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public noReturn_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof noReturn_args) return this.equals((noReturn_args) that); + return false; + } + + public boolean equals(noReturn_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(noReturn_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("noReturn_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public noReturn_argsStandardScheme getScheme() { + return new noReturn_argsStandardScheme(); + } + } + + private static class noReturn_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public noReturn_argsTupleScheme getScheme() { + return new noReturn_argsTupleScheme(); + } + } + + private static class noReturn_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class noReturn_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_result"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_resultTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_result.class, metaDataMap); + } + + public noReturn_result() {} + + /** Performs a deep copy on other. */ + public noReturn_result(noReturn_result other) {} + + @Override + public noReturn_result deepCopy() { + return new noReturn_result(this); + } + + @Override + public void clear() {} + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof noReturn_result) return this.equals((noReturn_result) that); + return false; + } + + public boolean equals(noReturn_result that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(noReturn_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("noReturn_result("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public noReturn_resultStandardScheme getScheme() { + return new noReturn_resultStandardScheme(); + } + } + + private static class noReturn_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public noReturn_resultTupleScheme getScheme() { + return new noReturn_resultTupleScheme(); + } + } + + private static class noReturn_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class oneWayHasArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayHasArgs_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayHasArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayHasArgs_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayHasArgs_args.class, metaDataMap); + } + + public oneWayHasArgs_args() {} + + public oneWayHasArgs_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public oneWayHasArgs_args(oneWayHasArgs_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + @Override + public oneWayHasArgs_args deepCopy() { + return new oneWayHasArgs_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public oneWayHasArgs_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWayHasArgs_args) return this.equals((oneWayHasArgs_args) that); + return false; + } + + public boolean equals(oneWayHasArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(oneWayHasArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWayHasArgs_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayHasArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWayHasArgs_argsStandardScheme getScheme() { + return new oneWayHasArgs_argsStandardScheme(); + } + } + + private static class oneWayHasArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayHasArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWayHasArgs_argsTupleScheme getScheme() { + return new oneWayHasArgs_argsTupleScheme(); + } + } + + private static class oneWayHasArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class oneWay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWay_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWay_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWay_args.class, metaDataMap); + } + + public oneWay_args() {} + + /** Performs a deep copy on other. */ + public oneWay_args(oneWay_args other) {} + + @Override + public oneWay_args deepCopy() { + return new oneWay_args(this); + } + + @Override + public void clear() {} + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWay_args) return this.equals((oneWay_args) that); + return false; + } + + public boolean equals(oneWay_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWay_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWay_argsStandardScheme getScheme() { + return new oneWay_argsStandardScheme(); + } + } + + private static class oneWay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWay_argsTupleScheme getScheme() { + return new oneWay_argsTupleScheme(); + } + } + + private static class oneWay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class oneWayWithError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayWithError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayWithError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayWithError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayWithError_args.class, metaDataMap); + } + + public oneWayWithError_args() {} + + /** Performs a deep copy on other. */ + public oneWayWithError_args(oneWayWithError_args other) {} + + @Override + public oneWayWithError_args deepCopy() { + return new oneWayWithError_args(this); + } + + @Override + public void clear() {} + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWayWithError_args) return this.equals((oneWayWithError_args) that); + return false; + } + + public boolean equals(oneWayWithError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWayWithError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWayWithError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayWithError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWayWithError_argsStandardScheme getScheme() { + return new oneWayWithError_argsStandardScheme(); + } + } + + private static class oneWayWithError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayWithError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWayWithError_argsTupleScheme getScheme() { + return new oneWayWithError_argsTupleScheme(); + } + } + + private static class oneWayWithError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class data_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_args"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable User user; // required + public @org.apache.thrift.annotation.Nullable Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(data_args.class, metaDataMap); + } + + public data_args() {} + + public data_args(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public data_args(data_args other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + @Override + public data_args deepCopy() { + return new data_args(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + @org.apache.thrift.annotation.Nullable + public User getUser() { + return this.user; + } + + public data_args setUser(@org.apache.thrift.annotation.Nullable User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + @org.apache.thrift.annotation.Nullable + public Account getAccount() { + return this.account; + } + + public data_args setAccount(@org.apache.thrift.annotation.Nullable Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof data_args) return this.equals((data_args) that); + return false; + } + + public boolean equals(data_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetUser(), other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAccount(), other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("data_args("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public data_argsStandardScheme getScheme() { + return new data_argsStandardScheme(); + } + } + + private static class data_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, data_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public data_argsTupleScheme getScheme() { + return new data_argsTupleScheme(); + } + } + + private static class data_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetUser()) { + optionals.set(0); + } + if (struct.isSetAccount()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetUser()) { + struct.user.write(oprot); + } + if (struct.isSetAccount()) { + struct.account.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } + if (incoming.get(1)) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class data_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRUCT, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable UserAccount success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, UserAccount.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + data_result.class, metaDataMap); + } + + public data_result() {} + + public data_result(UserAccount success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public data_result(data_result other) { + if (other.isSetSuccess()) { + this.success = new UserAccount(other.success); + } + } + + @Override + public data_result deepCopy() { + return new data_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public UserAccount getSuccess() { + return this.success; + } + + public data_result setSuccess(@org.apache.thrift.annotation.Nullable UserAccount success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((UserAccount) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof data_result) return this.equals((data_result) that); + return false; + } + + public boolean equals(data_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("data_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public data_resultStandardScheme getScheme() { + return new data_resultStandardScheme(); + } + } + + private static class data_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, data_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public data_resultTupleScheme getScheme() { + return new data_resultTupleScheme(); + } + } + + private static class data_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_20_0/User.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_20_0/User.java new file mode 100644 index 000000000000..7dfcd24b1ecf --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_20_0/User.java @@ -0,0 +1,609 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_20_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.20.0)", + date = "2025-02-27") +public class User + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("User"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "userId", org.apache.thrift.protocol.TType.STRING, (short) 2); + private static final org.apache.thrift.protocol.TField AGE_FIELD_DESC = + new org.apache.thrift.protocol.TField("age", org.apache.thrift.protocol.TType.I32, (short) 3); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String name; // required + public @org.apache.thrift.annotation.Nullable java.lang.String userId; // required + public int age; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + NAME((short) 1, "name"), + USER_ID((short) 2, "userId"), + AGE((short) 3, "age"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // NAME + return NAME; + case 2: // USER_ID + return USER_ID; + case 3: // AGE + return AGE; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __AGE_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.USER_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "userId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.AGE, + new org.apache.thrift.meta_data.FieldMetaData( + "age", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(User.class, metaDataMap); + } + + public User() {} + + public User(java.lang.String name, java.lang.String userId, int age) { + this(); + this.name = name; + this.userId = userId; + this.age = age; + setAgeIsSet(true); + } + + /** Performs a deep copy on other. */ + public User(User other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetName()) { + this.name = other.name; + } + if (other.isSetUserId()) { + this.userId = other.userId; + } + this.age = other.age; + } + + @Override + public User deepCopy() { + return new User(this); + } + + @Override + public void clear() { + this.name = null; + this.userId = null; + setAgeIsSet(false); + this.age = 0; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getName() { + return this.name; + } + + public User setName(@org.apache.thrift.annotation.Nullable java.lang.String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getUserId() { + return this.userId; + } + + public User setUserId(@org.apache.thrift.annotation.Nullable java.lang.String userId) { + this.userId = userId; + return this; + } + + public void unsetUserId() { + this.userId = null; + } + + /** Returns true if field userId is set (has been assigned a value) and false otherwise */ + public boolean isSetUserId() { + return this.userId != null; + } + + public void setUserIdIsSet(boolean value) { + if (!value) { + this.userId = null; + } + } + + public int getAge() { + return this.age; + } + + public User setAge(int age) { + this.age = age; + setAgeIsSet(true); + return this; + } + + public void unsetAge() { + __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __AGE_ISSET_ID); + } + + /** Returns true if field age is set (has been assigned a value) and false otherwise */ + public boolean isSetAge() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __AGE_ISSET_ID); + } + + public void setAgeIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __AGE_ISSET_ID, value); + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case NAME: + if (value == null) { + unsetName(); + } else { + setName((java.lang.String) value); + } + break; + + case USER_ID: + if (value == null) { + unsetUserId(); + } else { + setUserId((java.lang.String) value); + } + break; + + case AGE: + if (value == null) { + unsetAge(); + } else { + setAge((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case NAME: + return getName(); + + case USER_ID: + return getUserId(); + + case AGE: + return getAge(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case NAME: + return isSetName(); + case USER_ID: + return isSetUserId(); + case AGE: + return isSetAge(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof User) return this.equals((User) that); + return false; + } + + public boolean equals(User that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + boolean this_present_userId = true && this.isSetUserId(); + boolean that_present_userId = true && that.isSetUserId(); + if (this_present_userId || that_present_userId) { + if (!(this_present_userId && that_present_userId)) return false; + if (!this.userId.equals(that.userId)) return false; + } + + boolean this_present_age = true; + boolean that_present_age = true; + if (this_present_age || that_present_age) { + if (!(this_present_age && that_present_age)) return false; + if (this.age != that.age) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + hashCode = hashCode * 8191 + ((isSetUserId()) ? 131071 : 524287); + if (isSetUserId()) hashCode = hashCode * 8191 + userId.hashCode(); + + hashCode = hashCode * 8191 + age; + + return hashCode; + } + + @Override + public int compareTo(User other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetName(), other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetUserId(), other.isSetUserId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAge(), other.isSetAge()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAge()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.age, other.age); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("User("); + boolean first = true; + + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + if (!first) sb.append(", "); + sb.append("userId:"); + if (this.userId == null) { + sb.append("null"); + } else { + sb.append(this.userId); + } + first = false; + if (!first) sb.append(", "); + sb.append("age:"); + sb.append(this.age); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (name == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'name' was not present! Struct: " + toString()); + } + if (userId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'userId' was not present! Struct: " + toString()); + } + // alas, we cannot check 'age' because it's a primitive and you chose the non-beans generator. + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + @Override + public UserStandardScheme getScheme() { + return new UserStandardScheme(); + } + } + + private static class UserStandardScheme extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // AGE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + if (!struct.isSetAge()) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'age' was not found in serialized data! Struct: " + toString()); + } + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, User struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + if (struct.userId != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userId); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(AGE_FIELD_DESC); + oprot.writeI32(struct.age); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + @Override + public UserTupleScheme getScheme() { + return new UserTupleScheme(); + } + } + + private static class UserTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.name); + oprot.writeString(struct.userId); + oprot.writeI32(struct.age); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.name = iprot.readString(); + struct.setNameIsSet(true); + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_20_0/UserAccount.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_20_0/UserAccount.java new file mode 100644 index 000000000000..92e5c3ad446e --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_20_0/UserAccount.java @@ -0,0 +1,520 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_20_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.20.0)", + date = "2025-02-27") +public class UserAccount + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("UserAccount"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserAccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserAccountTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable User user; // required + public @org.apache.thrift.annotation.Nullable Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserAccount.class, metaDataMap); + } + + public UserAccount() {} + + public UserAccount(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public UserAccount(UserAccount other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + @Override + public UserAccount deepCopy() { + return new UserAccount(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + @org.apache.thrift.annotation.Nullable + public User getUser() { + return this.user; + } + + public UserAccount setUser(@org.apache.thrift.annotation.Nullable User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + @org.apache.thrift.annotation.Nullable + public Account getAccount() { + return this.account; + } + + public UserAccount setAccount(@org.apache.thrift.annotation.Nullable Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof UserAccount) return this.equals((UserAccount) that); + return false; + } + + public boolean equals(UserAccount that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(UserAccount other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetUser(), other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAccount(), other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("UserAccount("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (user == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'user' was not present! Struct: " + toString()); + } + if (account == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'account' was not present! Struct: " + toString()); + } + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserAccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public UserAccountStandardScheme getScheme() { + return new UserAccountStandardScheme(); + } + } + + private static class UserAccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, UserAccount struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserAccountTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public UserAccountTupleScheme getScheme() { + return new UserAccountTupleScheme(); + } + } + + private static class UserAccountTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user.write(oprot); + struct.account.write(oprot); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_21_0/Account.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_21_0/Account.java new file mode 100644 index 000000000000..b07dd9839b35 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_21_0/Account.java @@ -0,0 +1,508 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_21_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.21.0)", + date = "2025-02-27") +public class Account + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("Account"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField CARD_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "cardId", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new AccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new AccountTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String zone; // required + public @org.apache.thrift.annotation.Nullable java.lang.String cardId; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + CARD_ID((short) 2, "cardId"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // CARD_ID + return CARD_ID; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.CARD_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "cardId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Account.class, metaDataMap); + } + + public Account() {} + + public Account(java.lang.String zone, java.lang.String cardId) { + this(); + this.zone = zone; + this.cardId = cardId; + } + + /** Performs a deep copy on other. */ + public Account(Account other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetCardId()) { + this.cardId = other.cardId; + } + } + + @Override + public Account deepCopy() { + return new Account(this); + } + + @Override + public void clear() { + this.zone = null; + this.cardId = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getZone() { + return this.zone; + } + + public Account setZone(@org.apache.thrift.annotation.Nullable java.lang.String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getCardId() { + return this.cardId; + } + + public Account setCardId(@org.apache.thrift.annotation.Nullable java.lang.String cardId) { + this.cardId = cardId; + return this; + } + + public void unsetCardId() { + this.cardId = null; + } + + /** Returns true if field cardId is set (has been assigned a value) and false otherwise */ + public boolean isSetCardId() { + return this.cardId != null; + } + + public void setCardIdIsSet(boolean value) { + if (!value) { + this.cardId = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((java.lang.String) value); + } + break; + + case CARD_ID: + if (value == null) { + unsetCardId(); + } else { + setCardId((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case CARD_ID: + return getCardId(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case CARD_ID: + return isSetCardId(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof Account) return this.equals((Account) that); + return false; + } + + public boolean equals(Account that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_cardId = true && this.isSetCardId(); + boolean that_present_cardId = true && that.isSetCardId(); + if (this_present_cardId || that_present_cardId) { + if (!(this_present_cardId && that_present_cardId)) return false; + if (!this.cardId.equals(that.cardId)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetCardId()) ? 131071 : 524287); + if (isSetCardId()) hashCode = hashCode * 8191 + cardId.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(Account other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetZone(), other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetCardId(), other.isSetCardId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCardId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cardId, other.cardId); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("Account("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("cardId:"); + if (this.cardId == null) { + sb.append("null"); + } else { + sb.append(this.cardId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (zone == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'zone' was not present! Struct: " + toString()); + } + if (cardId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'cardId' was not present! Struct: " + toString()); + } + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class AccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public AccountStandardScheme getScheme() { + return new AccountStandardScheme(); + } + } + + private static class AccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // CARD_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, Account struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.cardId != null) { + oprot.writeFieldBegin(CARD_ID_FIELD_DESC); + oprot.writeString(struct.cardId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class AccountTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + @Override + public AccountTupleScheme getScheme() { + return new AccountTupleScheme(); + } + } + + private static class AccountTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.zone); + oprot.writeString(struct.cardId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_21_0/ThriftService.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_21_0/ThriftService.java new file mode 100644 index 000000000000..800efe8cf4cf --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_21_0/ThriftService.java @@ -0,0 +1,8598 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_21_0; + +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.21.0)", + date = "2025-02-27") +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +public class ThriftService { + + public interface Iface { + + public java.lang.String sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException; + + public java.lang.String withDelay(int delay) throws org.apache.thrift.TException; + + public java.lang.String withoutArgs() throws org.apache.thrift.TException; + + public java.lang.String withError() throws org.apache.thrift.TException; + + public java.lang.String withCollisioin(java.lang.String input) + throws org.apache.thrift.TException; + + public void noReturn(int delay) throws org.apache.thrift.TException; + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException; + + public void oneWay() throws org.apache.thrift.TException; + + public void oneWayWithError() throws org.apache.thrift.TException; + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException; + } + + public interface AsyncIface { + + public void sayHello( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withCollisioin( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + } + + public static class Client extends org.apache.thrift.TServiceClient implements Iface { + public static class Factory implements org.apache.thrift.TServiceClientFactory { + public Factory() {} + + @Override + public Client getClient(org.apache.thrift.protocol.TProtocol prot) { + return new Client(prot); + } + + @Override + public Client getClient( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + return new Client(iprot, oprot); + } + } + + public Client(org.apache.thrift.protocol.TProtocol prot) { + super(prot, prot); + } + + public Client( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + super(iprot, oprot); + } + + @Override + public java.lang.String sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException { + send_sayHello(zone, name); + return recv_sayHello(); + } + + public void send_sayHello(java.lang.String zone, java.lang.String name) + throws org.apache.thrift.TException { + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + sendBase("sayHello", args); + } + + public java.lang.String recv_sayHello() throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + receiveBase(result, "sayHello"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "sayHello failed: unknown result"); + } + + @Override + public java.lang.String withDelay(int delay) throws org.apache.thrift.TException { + send_withDelay(delay); + return recv_withDelay(); + } + + public void send_withDelay(int delay) throws org.apache.thrift.TException { + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + sendBase("withDelay", args); + } + + public java.lang.String recv_withDelay() throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + receiveBase(result, "withDelay"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withDelay failed: unknown result"); + } + + @Override + public java.lang.String withoutArgs() throws org.apache.thrift.TException { + send_withoutArgs(); + return recv_withoutArgs(); + } + + public void send_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_args args = new withoutArgs_args(); + sendBase("withoutArgs", args); + } + + public java.lang.String recv_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + receiveBase(result, "withoutArgs"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withoutArgs failed: unknown result"); + } + + @Override + public java.lang.String withError() throws org.apache.thrift.TException { + send_withError(); + return recv_withError(); + } + + public void send_withError() throws org.apache.thrift.TException { + withError_args args = new withError_args(); + sendBase("withError", args); + } + + public java.lang.String recv_withError() throws org.apache.thrift.TException { + withError_result result = new withError_result(); + receiveBase(result, "withError"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withError failed: unknown result"); + } + + @Override + public java.lang.String withCollisioin(java.lang.String input) + throws org.apache.thrift.TException { + send_withCollisioin(input); + return recv_withCollisioin(); + } + + public void send_withCollisioin(java.lang.String input) throws org.apache.thrift.TException { + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + sendBase("withCollisioin", args); + } + + public java.lang.String recv_withCollisioin() throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + receiveBase(result, "withCollisioin"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withCollisioin failed: unknown result"); + } + + @Override + public void noReturn(int delay) throws org.apache.thrift.TException { + send_noReturn(delay); + recv_noReturn(); + } + + public void send_noReturn(int delay) throws org.apache.thrift.TException { + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + sendBase("noReturn", args); + } + + public void recv_noReturn() throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + receiveBase(result, "noReturn"); + return; + } + + @Override + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException { + send_oneWayHasArgs(delay); + } + + public void send_oneWayHasArgs(int delay) throws org.apache.thrift.TException { + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + sendBaseOneway("oneWayHasArgs", args); + } + + @Override + public void oneWay() throws org.apache.thrift.TException { + send_oneWay(); + } + + public void send_oneWay() throws org.apache.thrift.TException { + oneWay_args args = new oneWay_args(); + sendBaseOneway("oneWay", args); + } + + @Override + public void oneWayWithError() throws org.apache.thrift.TException { + send_oneWayWithError(); + } + + public void send_oneWayWithError() throws org.apache.thrift.TException { + oneWayWithError_args args = new oneWayWithError_args(); + sendBaseOneway("oneWayWithError", args); + } + + @Override + public UserAccount data(User user, Account account) throws org.apache.thrift.TException { + send_data(user, account); + return recv_data(); + } + + public void send_data(User user, Account account) throws org.apache.thrift.TException { + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + sendBase("data", args); + } + + public UserAccount recv_data() throws org.apache.thrift.TException { + data_result result = new data_result(); + receiveBase(result, "data"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, "data failed: unknown result"); + } + } + + public static class AsyncClient extends org.apache.thrift.async.TAsyncClient + implements AsyncIface { + public static class Factory + implements org.apache.thrift.async.TAsyncClientFactory { + private org.apache.thrift.async.TAsyncClientManager clientManager; + private org.apache.thrift.protocol.TProtocolFactory protocolFactory; + + public Factory( + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.protocol.TProtocolFactory protocolFactory) { + this.clientManager = clientManager; + this.protocolFactory = protocolFactory; + } + + @Override + public AsyncClient getAsyncClient( + org.apache.thrift.transport.TNonblockingTransport transport) { + return new AsyncClient(protocolFactory, clientManager, transport); + } + } + + public AsyncClient( + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.transport.TNonblockingTransport transport) { + super(protocolFactory, clientManager, transport); + } + + @Override + public void sayHello( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + sayHello_call method_call = + new sayHello_call(zone, name, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class sayHello_call + extends org.apache.thrift.async.TAsyncMethodCall { + private java.lang.String zone; + private java.lang.String name; + + public sayHello_call( + java.lang.String zone, + java.lang.String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.zone = zone; + this.name = name; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "sayHello", org.apache.thrift.protocol.TMessageType.CALL, 0)); + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_sayHello(); + } + } + + @Override + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withDelay_call method_call = + new withDelay_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withDelay_call + extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public withDelay_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withDelay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withDelay(); + } + } + + @Override + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withoutArgs_call method_call = + new withoutArgs_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withoutArgs_call + extends org.apache.thrift.async.TAsyncMethodCall { + public withoutArgs_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withoutArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withoutArgs_args args = new withoutArgs_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withoutArgs(); + } + } + + @Override + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withError_call method_call = + new withError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withError_call + extends org.apache.thrift.async.TAsyncMethodCall { + public withError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withError_args args = new withError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withError(); + } + } + + @Override + public void withCollisioin( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withCollisioin_call method_call = + new withCollisioin_call(input, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withCollisioin_call + extends org.apache.thrift.async.TAsyncMethodCall { + private java.lang.String input; + + public withCollisioin_call( + java.lang.String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.input = input; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withCollisioin", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public java.lang.String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withCollisioin(); + } + } + + @Override + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + noReturn_call method_call = + new noReturn_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class noReturn_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public noReturn_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "noReturn", org.apache.thrift.protocol.TMessageType.CALL, 0)); + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + (new Client(prot)).recv_noReturn(); + return null; + } + } + + @Override + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayHasArgs_call method_call = + new oneWayHasArgs_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayHasArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public oneWayHasArgs_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + this.delay = delay; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayHasArgs", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + @Override + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWay_call method_call = + new oneWay_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWay_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWay_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWay", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWay_args args = new oneWay_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + @Override + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayWithError_call method_call = + new oneWayWithError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayWithError_call + extends org.apache.thrift.async.TAsyncMethodCall { + public oneWayWithError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayWithError", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayWithError_args args = new oneWayWithError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public Void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return null; + } + } + + @Override + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + data_call method_call = + new data_call(user, account, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class data_call extends org.apache.thrift.async.TAsyncMethodCall { + private User user; + private Account account; + + public data_call( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.user = user; + this.account = account; + } + + @Override + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "data", org.apache.thrift.protocol.TMessageType.CALL, 0)); + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + args.write(prot); + prot.writeMessageEnd(); + } + + @Override + public UserAccount getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new java.lang.IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_data(); + } + } + } + + public static class Processor extends org.apache.thrift.TBaseProcessor + implements org.apache.thrift.TProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(Processor.class.getName()); + + public Processor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + java.lang.String, + org.apache.thrift.ProcessFunction< + I, ? extends org.apache.thrift.TBase, ? extends org.apache.thrift.TBase>>())); + } + + protected Processor( + I iface, + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction< + I, ? extends org.apache.thrift.TBase, ? extends org.apache.thrift.TBase>> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction< + I, ? extends org.apache.thrift.TBase, ? extends org.apache.thrift.TBase>> + getProcessMap( + java.util.Map< + java.lang.String, + org.apache.thrift.ProcessFunction< + I, + ? extends org.apache.thrift.TBase, + ? extends org.apache.thrift.TBase>> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.ProcessFunction { + public sayHello() { + super("sayHello"); + } + + @Override + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + @Override + public boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public sayHello_result getEmptyResultInstance() { + return new sayHello_result(); + } + + @Override + public sayHello_result getResult(I iface, sayHello_args args) + throws org.apache.thrift.TException { + sayHello_result result = getEmptyResultInstance(); + result.success = iface.sayHello(args.zone, args.name); + return result; + } + } + + public static class withDelay + extends org.apache.thrift.ProcessFunction { + public withDelay() { + super("withDelay"); + } + + @Override + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + @Override + public boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public withDelay_result getEmptyResultInstance() { + return new withDelay_result(); + } + + @Override + public withDelay_result getResult(I iface, withDelay_args args) + throws org.apache.thrift.TException { + withDelay_result result = getEmptyResultInstance(); + result.success = iface.withDelay(args.delay); + return result; + } + } + + public static class withoutArgs + extends org.apache.thrift.ProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + @Override + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + @Override + public boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public withoutArgs_result getEmptyResultInstance() { + return new withoutArgs_result(); + } + + @Override + public withoutArgs_result getResult(I iface, withoutArgs_args args) + throws org.apache.thrift.TException { + withoutArgs_result result = getEmptyResultInstance(); + result.success = iface.withoutArgs(); + return result; + } + } + + public static class withError + extends org.apache.thrift.ProcessFunction { + public withError() { + super("withError"); + } + + @Override + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + @Override + public boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public withError_result getEmptyResultInstance() { + return new withError_result(); + } + + @Override + public withError_result getResult(I iface, withError_args args) + throws org.apache.thrift.TException { + withError_result result = getEmptyResultInstance(); + result.success = iface.withError(); + return result; + } + } + + public static class withCollisioin + extends org.apache.thrift.ProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + @Override + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + @Override + public boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public withCollisioin_result getEmptyResultInstance() { + return new withCollisioin_result(); + } + + @Override + public withCollisioin_result getResult(I iface, withCollisioin_args args) + throws org.apache.thrift.TException { + withCollisioin_result result = getEmptyResultInstance(); + result.success = iface.withCollisioin(args.input); + return result; + } + } + + public static class noReturn + extends org.apache.thrift.ProcessFunction { + public noReturn() { + super("noReturn"); + } + + @Override + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + @Override + public boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public noReturn_result getEmptyResultInstance() { + return new noReturn_result(); + } + + @Override + public noReturn_result getResult(I iface, noReturn_args args) + throws org.apache.thrift.TException { + noReturn_result result = getEmptyResultInstance(); + iface.noReturn(args.delay); + return result; + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.ProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + @Override + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + @Override + public boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public org.apache.thrift.TBase getEmptyResultInstance() { + return null; + } + + @Override + public org.apache.thrift.TBase getResult(I iface, oneWayHasArgs_args args) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay); + return null; + } + } + + public static class oneWay + extends org.apache.thrift.ProcessFunction { + public oneWay() { + super("oneWay"); + } + + @Override + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + @Override + public boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public org.apache.thrift.TBase getEmptyResultInstance() { + return null; + } + + @Override + public org.apache.thrift.TBase getResult(I iface, oneWay_args args) + throws org.apache.thrift.TException { + iface.oneWay(); + return null; + } + } + + public static class oneWayWithError + extends org.apache.thrift.ProcessFunction< + I, oneWayWithError_args, org.apache.thrift.TBase> { + public oneWayWithError() { + super("oneWayWithError"); + } + + @Override + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + @Override + public boolean isOneway() { + return true; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public org.apache.thrift.TBase getEmptyResultInstance() { + return null; + } + + @Override + public org.apache.thrift.TBase getResult(I iface, oneWayWithError_args args) + throws org.apache.thrift.TException { + iface.oneWayWithError(); + return null; + } + } + + public static class data + extends org.apache.thrift.ProcessFunction { + public data() { + super("data"); + } + + @Override + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + @Override + public boolean isOneway() { + return false; + } + + @Override + protected boolean rethrowUnhandledExceptions() { + return false; + } + + @Override + public data_result getEmptyResultInstance() { + return new data_result(); + } + + @Override + public data_result getResult(I iface, data_args args) throws org.apache.thrift.TException { + data_result result = getEmptyResultInstance(); + result.success = iface.data(args.user, args.account); + return result; + } + } + } + + public static class AsyncProcessor + extends org.apache.thrift.TBaseAsyncProcessor { + private static final org.slf4j.Logger _LOGGER = + org.slf4j.LoggerFactory.getLogger(AsyncProcessor.class.getName()); + + public AsyncProcessor(I iface) { + super( + iface, + getProcessMap( + new java.util.HashMap< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, + ? extends org.apache.thrift.TBase, + ?, + ? extends org.apache.thrift.TBase>>())); + } + + protected AsyncProcessor( + I iface, + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?, ? extends org.apache.thrift.TBase>> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?, ? extends org.apache.thrift.TBase>> + getProcessMap( + java.util.Map< + java.lang.String, + org.apache.thrift.AsyncProcessFunction< + I, + ? extends org.apache.thrift.TBase, + ?, + ? extends org.apache.thrift.TBase>> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.AsyncProcessFunction< + I, sayHello_args, java.lang.String, sayHello_result> { + public sayHello() { + super("sayHello"); + } + + @Override + public sayHello_result getEmptyResultInstance() { + return new sayHello_result(); + } + + @Override + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(java.lang.String o) { + sayHello_result result = new sayHello_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + sayHello_result result = new sayHello_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + public boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + sayHello_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.sayHello(args.zone, args.name, resultHandler); + } + } + + public static class withDelay + extends org.apache.thrift.AsyncProcessFunction< + I, withDelay_args, java.lang.String, withDelay_result> { + public withDelay() { + super("withDelay"); + } + + @Override + public withDelay_result getEmptyResultInstance() { + return new withDelay_result(); + } + + @Override + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(java.lang.String o) { + withDelay_result result = new withDelay_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withDelay_result result = new withDelay_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + public boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + withDelay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withDelay(args.delay, resultHandler); + } + } + + public static class withoutArgs + extends org.apache.thrift.AsyncProcessFunction< + I, withoutArgs_args, java.lang.String, withoutArgs_result> { + public withoutArgs() { + super("withoutArgs"); + } + + @Override + public withoutArgs_result getEmptyResultInstance() { + return new withoutArgs_result(); + } + + @Override + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(java.lang.String o) { + withoutArgs_result result = new withoutArgs_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withoutArgs_result result = new withoutArgs_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + public boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + withoutArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withoutArgs(resultHandler); + } + } + + public static class withError + extends org.apache.thrift.AsyncProcessFunction< + I, withError_args, java.lang.String, withError_result> { + public withError() { + super("withError"); + } + + @Override + public withError_result getEmptyResultInstance() { + return new withError_result(); + } + + @Override + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(java.lang.String o) { + withError_result result = new withError_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withError_result result = new withError_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + public boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + withError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withError(resultHandler); + } + } + + public static class withCollisioin + extends org.apache.thrift.AsyncProcessFunction< + I, withCollisioin_args, java.lang.String, withCollisioin_result> { + public withCollisioin() { + super("withCollisioin"); + } + + @Override + public withCollisioin_result getEmptyResultInstance() { + return new withCollisioin_result(); + } + + @Override + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(java.lang.String o) { + withCollisioin_result result = new withCollisioin_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + withCollisioin_result result = new withCollisioin_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + public boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + withCollisioin_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.withCollisioin(args.input, resultHandler); + } + } + + public static class noReturn + extends org.apache.thrift.AsyncProcessFunction { + public noReturn() { + super("noReturn"); + } + + @Override + public noReturn_result getEmptyResultInstance() { + return new noReturn_result(); + } + + @Override + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(Void o) { + noReturn_result result = new noReturn_result(); + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + noReturn_result result = new noReturn_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + public boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + noReturn_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.noReturn(args.delay, resultHandler); + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.AsyncProcessFunction< + I, oneWayHasArgs_args, Void, org.apache.thrift.TBase> { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + @Override + public org.apache.thrift.TBase getEmptyResultInstance() { + return null; + } + + @Override + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(Void o) {} + + @Override + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + @Override + public boolean isOneway() { + return true; + } + + @Override + public void start( + I iface, + oneWayHasArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay, resultHandler); + } + } + + public static class oneWay + extends org.apache.thrift.AsyncProcessFunction< + I, oneWay_args, Void, org.apache.thrift.TBase> { + public oneWay() { + super("oneWay"); + } + + @Override + public org.apache.thrift.TBase getEmptyResultInstance() { + return null; + } + + @Override + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(Void o) {} + + @Override + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + @Override + public boolean isOneway() { + return true; + } + + @Override + public void start( + I iface, + oneWay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWay(resultHandler); + } + } + + public static class oneWayWithError + extends org.apache.thrift.AsyncProcessFunction< + I, oneWayWithError_args, Void, org.apache.thrift.TBase> { + public oneWayWithError() { + super("oneWayWithError"); + } + + @Override + public org.apache.thrift.TBase getEmptyResultInstance() { + return null; + } + + @Override + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(Void o) {} + + @Override + public void onError(java.lang.Exception e) { + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + } else { + _LOGGER.error("Exception inside oneway handler", e); + } + } + }; + } + + @Override + public boolean isOneway() { + return true; + } + + @Override + public void start( + I iface, + oneWayWithError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.oneWayWithError(resultHandler); + } + } + + public static class data + extends org.apache.thrift.AsyncProcessFunction { + public data() { + super("data"); + } + + @Override + public data_result getEmptyResultInstance() { + return new data_result(); + } + + @Override + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + @Override + public org.apache.thrift.async.AsyncMethodCallback getResultHandler( + final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, + final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new org.apache.thrift.async.AsyncMethodCallback() { + @Override + public void onComplete(UserAccount o) { + data_result result = new data_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + } catch (org.apache.thrift.transport.TTransportException e) { + _LOGGER.error("TTransportException writing to internal frame buffer", e); + fb.close(); + } catch (java.lang.Exception e) { + _LOGGER.error("Exception writing to internal frame buffer", e); + onError(e); + } + } + + @Override + public void onError(java.lang.Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TSerializable msg; + data_result result = new data_result(); + if (e instanceof org.apache.thrift.transport.TTransportException) { + _LOGGER.error("TTransportException inside handler", e); + fb.close(); + return; + } else if (e instanceof org.apache.thrift.TApplicationException) { + _LOGGER.error("TApplicationException inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TApplicationException) e; + } else { + _LOGGER.error("Exception inside handler", e); + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + } catch (java.lang.Exception ex) { + _LOGGER.error("Exception writing to internal frame buffer", ex); + fb.close(); + } + } + }; + } + + @Override + public boolean isOneway() { + return false; + } + + @Override + public void start( + I iface, + data_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + iface.data(args.user, args.account, resultHandler); + } + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class sayHello_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_args"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String zone; // required + public @org.apache.thrift.annotation.Nullable java.lang.String name; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + NAME((short) 2, "name"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // NAME + return NAME; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_args.class, metaDataMap); + } + + public sayHello_args() {} + + public sayHello_args(java.lang.String zone, java.lang.String name) { + this(); + this.zone = zone; + this.name = name; + } + + /** Performs a deep copy on other. */ + public sayHello_args(sayHello_args other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetName()) { + this.name = other.name; + } + } + + @Override + public sayHello_args deepCopy() { + return new sayHello_args(this); + } + + @Override + public void clear() { + this.zone = null; + this.name = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getZone() { + return this.zone; + } + + public sayHello_args setZone(@org.apache.thrift.annotation.Nullable java.lang.String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getName() { + return this.name; + } + + public sayHello_args setName(@org.apache.thrift.annotation.Nullable java.lang.String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((java.lang.String) value); + } + break; + + case NAME: + if (value == null) { + unsetName(); + } else { + setName((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case NAME: + return getName(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case NAME: + return isSetName(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof sayHello_args) return this.equals((sayHello_args) that); + return false; + } + + public boolean equals(sayHello_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetZone()) ? 131071 : 524287); + if (isSetZone()) hashCode = hashCode * 8191 + zone.hashCode(); + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetZone(), other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetName(), other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("sayHello_args("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public sayHello_argsStandardScheme getScheme() { + return new sayHello_argsStandardScheme(); + } + } + + private static class sayHello_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public sayHello_argsTupleScheme getScheme() { + return new sayHello_argsTupleScheme(); + } + } + + private static class sayHello_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetZone()) { + optionals.set(0); + } + if (struct.isSetName()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetZone()) { + oprot.writeString(struct.zone); + } + if (struct.isSetName()) { + oprot.writeString(struct.name); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } + if (incoming.get(1)) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class sayHello_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new sayHello_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new sayHello_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_result.class, metaDataMap); + } + + public sayHello_result() {} + + public sayHello_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public sayHello_result(sayHello_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + @Override + public sayHello_result deepCopy() { + return new sayHello_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public sayHello_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof sayHello_result) return this.equals((sayHello_result) that); + return false; + } + + public boolean equals(sayHello_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(sayHello_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("sayHello_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public sayHello_resultStandardScheme getScheme() { + return new sayHello_resultStandardScheme(); + } + } + + private static class sayHello_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public sayHello_resultTupleScheme getScheme() { + return new sayHello_resultTupleScheme(); + } + } + + private static class sayHello_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withDelay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_args.class, metaDataMap); + } + + public withDelay_args() {} + + public withDelay_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public withDelay_args(withDelay_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + @Override + public withDelay_args deepCopy() { + return new withDelay_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public withDelay_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withDelay_args) return this.equals((withDelay_args) that); + return false; + } + + public boolean equals(withDelay_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(withDelay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withDelay_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withDelay_argsStandardScheme getScheme() { + return new withDelay_argsStandardScheme(); + } + } + + private static class withDelay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withDelay_argsTupleScheme getScheme() { + return new withDelay_argsTupleScheme(); + } + } + + private static class withDelay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withDelay_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withDelay_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withDelay_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_result.class, metaDataMap); + } + + public withDelay_result() {} + + public withDelay_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withDelay_result(withDelay_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + @Override + public withDelay_result deepCopy() { + return new withDelay_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withDelay_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withDelay_result) return this.equals((withDelay_result) that); + return false; + } + + public boolean equals(withDelay_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withDelay_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withDelay_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withDelay_resultStandardScheme getScheme() { + return new withDelay_resultStandardScheme(); + } + } + + private static class withDelay_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withDelay_resultTupleScheme getScheme() { + return new withDelay_resultTupleScheme(); + } + } + + private static class withDelay_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withoutArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_args.class, metaDataMap); + } + + public withoutArgs_args() {} + + /** Performs a deep copy on other. */ + public withoutArgs_args(withoutArgs_args other) {} + + @Override + public withoutArgs_args deepCopy() { + return new withoutArgs_args(this); + } + + @Override + public void clear() {} + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withoutArgs_args) return this.equals((withoutArgs_args) that); + return false; + } + + public boolean equals(withoutArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withoutArgs_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withoutArgs_argsStandardScheme getScheme() { + return new withoutArgs_argsStandardScheme(); + } + } + + private static class withoutArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withoutArgs_argsTupleScheme getScheme() { + return new withoutArgs_argsTupleScheme(); + } + } + + private static class withoutArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withoutArgs_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withoutArgs_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withoutArgs_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_result.class, metaDataMap); + } + + public withoutArgs_result() {} + + public withoutArgs_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withoutArgs_result(withoutArgs_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + @Override + public withoutArgs_result deepCopy() { + return new withoutArgs_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withoutArgs_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withoutArgs_result) return this.equals((withoutArgs_result) that); + return false; + } + + public boolean equals(withoutArgs_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withoutArgs_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withoutArgs_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withoutArgs_resultStandardScheme getScheme() { + return new withoutArgs_resultStandardScheme(); + } + } + + private static class withoutArgs_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withoutArgs_resultTupleScheme getScheme() { + return new withoutArgs_resultTupleScheme(); + } + } + + private static class withoutArgs_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_args.class, metaDataMap); + } + + public withError_args() {} + + /** Performs a deep copy on other. */ + public withError_args(withError_args other) {} + + @Override + public withError_args deepCopy() { + return new withError_args(this); + } + + @Override + public void clear() {} + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withError_args) return this.equals((withError_args) that); + return false; + } + + public boolean equals(withError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(withError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withError_argsStandardScheme getScheme() { + return new withError_argsStandardScheme(); + } + } + + private static class withError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withError_argsTupleScheme getScheme() { + return new withError_argsTupleScheme(); + } + } + + private static class withError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withError_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withError_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withError_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_result.class, metaDataMap); + } + + public withError_result() {} + + public withError_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withError_result(withError_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + @Override + public withError_result deepCopy() { + return new withError_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withError_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withError_result) return this.equals((withError_result) that); + return false; + } + + public boolean equals(withError_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withError_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withError_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withError_resultStandardScheme getScheme() { + return new withError_resultStandardScheme(); + } + } + + private static class withError_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withError_resultTupleScheme getScheme() { + return new withError_resultTupleScheme(); + } + } + + private static class withError_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withCollisioin_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_args"); + + private static final org.apache.thrift.protocol.TField INPUT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "input", org.apache.thrift.protocol.TType.STRING, (short) 3333); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String input; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + INPUT((short) 3333, "input"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 3333: // INPUT + return INPUT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.INPUT, + new org.apache.thrift.meta_data.FieldMetaData( + "input", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_args.class, metaDataMap); + } + + public withCollisioin_args() {} + + public withCollisioin_args(java.lang.String input) { + this(); + this.input = input; + } + + /** Performs a deep copy on other. */ + public withCollisioin_args(withCollisioin_args other) { + if (other.isSetInput()) { + this.input = other.input; + } + } + + @Override + public withCollisioin_args deepCopy() { + return new withCollisioin_args(this); + } + + @Override + public void clear() { + this.input = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getInput() { + return this.input; + } + + public withCollisioin_args setInput( + @org.apache.thrift.annotation.Nullable java.lang.String input) { + this.input = input; + return this; + } + + public void unsetInput() { + this.input = null; + } + + /** Returns true if field input is set (has been assigned a value) and false otherwise */ + public boolean isSetInput() { + return this.input != null; + } + + public void setInputIsSet(boolean value) { + if (!value) { + this.input = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case INPUT: + if (value == null) { + unsetInput(); + } else { + setInput((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case INPUT: + return getInput(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case INPUT: + return isSetInput(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withCollisioin_args) return this.equals((withCollisioin_args) that); + return false; + } + + public boolean equals(withCollisioin_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_input = true && this.isSetInput(); + boolean that_present_input = true && that.isSetInput(); + if (this_present_input || that_present_input) { + if (!(this_present_input && that_present_input)) return false; + if (!this.input.equals(that.input)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetInput()) ? 131071 : 524287); + if (isSetInput()) hashCode = hashCode * 8191 + input.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetInput(), other.isSetInput()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInput()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.input, other.input); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withCollisioin_args("); + boolean first = true; + + sb.append("input:"); + if (this.input == null) { + sb.append("null"); + } else { + sb.append(this.input); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withCollisioin_argsStandardScheme getScheme() { + return new withCollisioin_argsStandardScheme(); + } + } + + private static class withCollisioin_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 3333: // INPUT + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.input != null) { + oprot.writeFieldBegin(INPUT_FIELD_DESC); + oprot.writeString(struct.input); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withCollisioin_argsTupleScheme getScheme() { + return new withCollisioin_argsTupleScheme(); + } + } + + private static class withCollisioin_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetInput()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetInput()) { + oprot.writeString(struct.input); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class withCollisioin_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new withCollisioin_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new withCollisioin_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_result.class, metaDataMap); + } + + public withCollisioin_result() {} + + public withCollisioin_result(java.lang.String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withCollisioin_result(withCollisioin_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + @Override + public withCollisioin_result deepCopy() { + return new withCollisioin_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getSuccess() { + return this.success; + } + + public withCollisioin_result setSuccess( + @org.apache.thrift.annotation.Nullable java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof withCollisioin_result) return this.equals((withCollisioin_result) that); + return false; + } + + public boolean equals(withCollisioin_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(withCollisioin_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("withCollisioin_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withCollisioin_resultStandardScheme getScheme() { + return new withCollisioin_resultStandardScheme(); + } + } + + private static class withCollisioin_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public withCollisioin_resultTupleScheme getScheme() { + return new withCollisioin_resultTupleScheme(); + } + } + + private static class withCollisioin_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class noReturn_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_args.class, metaDataMap); + } + + public noReturn_args() {} + + public noReturn_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public noReturn_args(noReturn_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + @Override + public noReturn_args deepCopy() { + return new noReturn_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public noReturn_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof noReturn_args) return this.equals((noReturn_args) that); + return false; + } + + public boolean equals(noReturn_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(noReturn_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("noReturn_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public noReturn_argsStandardScheme getScheme() { + return new noReturn_argsStandardScheme(); + } + } + + private static class noReturn_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public noReturn_argsTupleScheme getScheme() { + return new noReturn_argsTupleScheme(); + } + } + + private static class noReturn_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class noReturn_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_result"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new noReturn_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new noReturn_resultTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_result.class, metaDataMap); + } + + public noReturn_result() {} + + /** Performs a deep copy on other. */ + public noReturn_result(noReturn_result other) {} + + @Override + public noReturn_result deepCopy() { + return new noReturn_result(this); + } + + @Override + public void clear() {} + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof noReturn_result) return this.equals((noReturn_result) that); + return false; + } + + public boolean equals(noReturn_result that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(noReturn_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("noReturn_result("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public noReturn_resultStandardScheme getScheme() { + return new noReturn_resultStandardScheme(); + } + } + + private static class noReturn_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public noReturn_resultTupleScheme getScheme() { + return new noReturn_resultTupleScheme(); + } + } + + private static class noReturn_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class oneWayHasArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayHasArgs_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayHasArgs_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayHasArgs_argsTupleSchemeFactory(); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayHasArgs_args.class, metaDataMap); + } + + public oneWayHasArgs_args() {} + + public oneWayHasArgs_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public oneWayHasArgs_args(oneWayHasArgs_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + @Override + public oneWayHasArgs_args deepCopy() { + return new oneWayHasArgs_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public oneWayHasArgs_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = + org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWayHasArgs_args) return this.equals((oneWayHasArgs_args) that); + return false; + } + + public boolean equals(oneWayHasArgs_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + delay; + + return hashCode; + } + + @Override + public int compareTo(oneWayHasArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetDelay(), other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWayHasArgs_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayHasArgs_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWayHasArgs_argsStandardScheme getScheme() { + return new oneWayHasArgs_argsStandardScheme(); + } + } + + private static class oneWayHasArgs_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayHasArgs_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWayHasArgs_argsTupleScheme getScheme() { + return new oneWayHasArgs_argsTupleScheme(); + } + } + + private static class oneWayHasArgs_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class oneWay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWay_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWay_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWay_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWay_args.class, metaDataMap); + } + + public oneWay_args() {} + + /** Performs a deep copy on other. */ + public oneWay_args(oneWay_args other) {} + + @Override + public oneWay_args deepCopy() { + return new oneWay_args(this); + } + + @Override + public void clear() {} + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWay_args) return this.equals((oneWay_args) that); + return false; + } + + public boolean equals(oneWay_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWay_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWay_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWay_argsStandardScheme getScheme() { + return new oneWay_argsStandardScheme(); + } + } + + private static class oneWay_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWay_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWay_argsTupleScheme getScheme() { + return new oneWay_argsTupleScheme(); + } + } + + private static class oneWay_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class oneWayWithError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayWithError_args"); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new oneWayWithError_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new oneWayWithError_argsTupleSchemeFactory(); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayWithError_args.class, metaDataMap); + } + + public oneWayWithError_args() {} + + /** Performs a deep copy on other. */ + public oneWayWithError_args(oneWayWithError_args other) {} + + @Override + public oneWayWithError_args deepCopy() { + return new oneWayWithError_args(this); + } + + @Override + public void clear() {} + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof oneWayWithError_args) return this.equals((oneWayWithError_args) that); + return false; + } + + public boolean equals(oneWayWithError_args that) { + if (that == null) return false; + if (this == that) return true; + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + return hashCode; + } + + @Override + public int compareTo(oneWayWithError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("oneWayWithError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayWithError_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWayWithError_argsStandardScheme getScheme() { + return new oneWayWithError_argsStandardScheme(); + } + } + + private static class oneWayWithError_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayWithError_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public oneWayWithError_argsTupleScheme getScheme() { + return new oneWayWithError_argsTupleScheme(); + } + } + + private static class oneWayWithError_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class data_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_args"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_argsStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_argsTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable User user; // required + public @org.apache.thrift.annotation.Nullable Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(data_args.class, metaDataMap); + } + + public data_args() {} + + public data_args(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public data_args(data_args other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + @Override + public data_args deepCopy() { + return new data_args(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + @org.apache.thrift.annotation.Nullable + public User getUser() { + return this.user; + } + + public data_args setUser(@org.apache.thrift.annotation.Nullable User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + @org.apache.thrift.annotation.Nullable + public Account getAccount() { + return this.account; + } + + public data_args setAccount(@org.apache.thrift.annotation.Nullable Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof data_args) return this.equals((data_args) that); + return false; + } + + public boolean equals(data_args that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetUser(), other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAccount(), other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("data_args("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_argsStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public data_argsStandardScheme getScheme() { + return new data_argsStandardScheme(); + } + } + + private static class data_argsStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, data_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_argsTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public data_argsTupleScheme getScheme() { + return new data_argsTupleScheme(); + } + } + + private static class data_argsTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetUser()) { + optionals.set(0); + } + if (struct.isSetAccount()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetUser()) { + struct.user.write(oprot); + } + if (struct.isSetAccount()) { + struct.account.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } + if (incoming.get(1)) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } + + @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) + public static class data_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRUCT, (short) 0); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new data_resultStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new data_resultTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable UserAccount success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> + metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, UserAccount.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + data_result.class, metaDataMap); + } + + public data_result() {} + + public data_result(UserAccount success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public data_result(data_result other) { + if (other.isSetSuccess()) { + this.success = new UserAccount(other.success); + } + } + + @Override + public data_result deepCopy() { + return new data_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + @org.apache.thrift.annotation.Nullable + public UserAccount getSuccess() { + return this.success; + } + + public data_result setSuccess(@org.apache.thrift.annotation.Nullable UserAccount success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((UserAccount) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof data_result) return this.equals((data_result) that); + return false; + } + + public boolean equals(data_result that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) hashCode = hashCode * 8191 + success.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(data_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("data_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_resultStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public data_resultStandardScheme getScheme() { + return new data_resultStandardScheme(); + } + } + + private static class data_resultStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, data_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_resultTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public data_resultTupleScheme getScheme() { + return new data_resultTupleScheme(); + } + } + + private static class data_resultTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_21_0/User.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_21_0/User.java new file mode 100644 index 000000000000..af82cfcc3f09 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_21_0/User.java @@ -0,0 +1,609 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_21_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.21.0)", + date = "2025-02-27") +public class User + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("User"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "userId", org.apache.thrift.protocol.TType.STRING, (short) 2); + private static final org.apache.thrift.protocol.TField AGE_FIELD_DESC = + new org.apache.thrift.protocol.TField("age", org.apache.thrift.protocol.TType.I32, (short) 3); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable java.lang.String name; // required + public @org.apache.thrift.annotation.Nullable java.lang.String userId; // required + public int age; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + NAME((short) 1, "name"), + USER_ID((short) 2, "userId"), + AGE((short) 3, "age"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // NAME + return NAME; + case 2: // USER_ID + return USER_ID; + case 3: // AGE + return AGE; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __AGE_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.USER_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "userId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.AGE, + new org.apache.thrift.meta_data.FieldMetaData( + "age", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(User.class, metaDataMap); + } + + public User() {} + + public User(java.lang.String name, java.lang.String userId, int age) { + this(); + this.name = name; + this.userId = userId; + this.age = age; + setAgeIsSet(true); + } + + /** Performs a deep copy on other. */ + public User(User other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetName()) { + this.name = other.name; + } + if (other.isSetUserId()) { + this.userId = other.userId; + } + this.age = other.age; + } + + @Override + public User deepCopy() { + return new User(this); + } + + @Override + public void clear() { + this.name = null; + this.userId = null; + setAgeIsSet(false); + this.age = 0; + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getName() { + return this.name; + } + + public User setName(@org.apache.thrift.annotation.Nullable java.lang.String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + @org.apache.thrift.annotation.Nullable + public java.lang.String getUserId() { + return this.userId; + } + + public User setUserId(@org.apache.thrift.annotation.Nullable java.lang.String userId) { + this.userId = userId; + return this; + } + + public void unsetUserId() { + this.userId = null; + } + + /** Returns true if field userId is set (has been assigned a value) and false otherwise */ + public boolean isSetUserId() { + return this.userId != null; + } + + public void setUserIdIsSet(boolean value) { + if (!value) { + this.userId = null; + } + } + + public int getAge() { + return this.age; + } + + public User setAge(int age) { + this.age = age; + setAgeIsSet(true); + return this; + } + + public void unsetAge() { + __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __AGE_ISSET_ID); + } + + /** Returns true if field age is set (has been assigned a value) and false otherwise */ + public boolean isSetAge() { + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __AGE_ISSET_ID); + } + + public void setAgeIsSet(boolean value) { + __isset_bitfield = + org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __AGE_ISSET_ID, value); + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case NAME: + if (value == null) { + unsetName(); + } else { + setName((java.lang.String) value); + } + break; + + case USER_ID: + if (value == null) { + unsetUserId(); + } else { + setUserId((java.lang.String) value); + } + break; + + case AGE: + if (value == null) { + unsetAge(); + } else { + setAge((java.lang.Integer) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case NAME: + return getName(); + + case USER_ID: + return getUserId(); + + case AGE: + return getAge(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case NAME: + return isSetName(); + case USER_ID: + return isSetUserId(); + case AGE: + return isSetAge(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof User) return this.equals((User) that); + return false; + } + + public boolean equals(User that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + boolean this_present_userId = true && this.isSetUserId(); + boolean that_present_userId = true && that.isSetUserId(); + if (this_present_userId || that_present_userId) { + if (!(this_present_userId && that_present_userId)) return false; + if (!this.userId.equals(that.userId)) return false; + } + + boolean this_present_age = true; + boolean that_present_age = true; + if (this_present_age || that_present_age) { + if (!(this_present_age && that_present_age)) return false; + if (this.age != that.age) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetName()) ? 131071 : 524287); + if (isSetName()) hashCode = hashCode * 8191 + name.hashCode(); + + hashCode = hashCode * 8191 + ((isSetUserId()) ? 131071 : 524287); + if (isSetUserId()) hashCode = hashCode * 8191 + userId.hashCode(); + + hashCode = hashCode * 8191 + age; + + return hashCode; + } + + @Override + public int compareTo(User other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetName(), other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetUserId(), other.isSetUserId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAge(), other.isSetAge()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAge()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.age, other.age); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("User("); + boolean first = true; + + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + if (!first) sb.append(", "); + sb.append("userId:"); + if (this.userId == null) { + sb.append("null"); + } else { + sb.append(this.userId); + } + first = false; + if (!first) sb.append(", "); + sb.append("age:"); + sb.append(this.age); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (name == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'name' was not present! Struct: " + toString()); + } + if (userId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'userId' was not present! Struct: " + toString()); + } + // alas, we cannot check 'age' because it's a primitive and you chose the non-beans generator. + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + @Override + public UserStandardScheme getScheme() { + return new UserStandardScheme(); + } + } + + private static class UserStandardScheme extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // AGE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + if (!struct.isSetAge()) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'age' was not found in serialized data! Struct: " + toString()); + } + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, User struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + if (struct.userId != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userId); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(AGE_FIELD_DESC); + oprot.writeI32(struct.age); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { + @Override + public UserTupleScheme getScheme() { + return new UserTupleScheme(); + } + } + + private static class UserTupleScheme extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + oprot.writeString(struct.name); + oprot.writeString(struct.userId); + oprot.writeI32(struct.age); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.name = iprot.readString(); + struct.setNameIsSet(true); + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_21_0/UserAccount.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_21_0/UserAccount.java new file mode 100644 index 000000000000..19ae60c229f2 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_21_0/UserAccount.java @@ -0,0 +1,520 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_21_0; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) +@javax.annotation.Generated( + value = "Autogenerated by Thrift Compiler (0.21.0)", + date = "2025-02-27") +public class UserAccount + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("UserAccount"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = + new UserAccountStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = + new UserAccountTupleSchemeFactory(); + + public @org.apache.thrift.annotation.Nullable User user; // required + public @org.apache.thrift.annotation.Nullable Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final java.util.Map byName = + new java.util.HashMap(); + + static { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + @org.apache.thrift.annotation.Nullable + public static _Fields findByName(java.lang.String name) { + return byName.get(name); + } + + private final short _thriftId; + private final java.lang.String _fieldName; + + _Fields(short thriftId, java.lang.String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + @Override + public short getThriftFieldId() { + return _thriftId; + } + + @Override + public java.lang.String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserAccount.class, metaDataMap); + } + + public UserAccount() {} + + public UserAccount(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public UserAccount(UserAccount other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + @Override + public UserAccount deepCopy() { + return new UserAccount(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + @org.apache.thrift.annotation.Nullable + public User getUser() { + return this.user; + } + + public UserAccount setUser(@org.apache.thrift.annotation.Nullable User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + @org.apache.thrift.annotation.Nullable + public Account getAccount() { + return this.account; + } + + public UserAccount setAccount(@org.apache.thrift.annotation.Nullable Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + @Override + public void setFieldValue( + _Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + @org.apache.thrift.annotation.Nullable + @Override + public java.lang.Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new java.lang.IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + @Override + public boolean isSet(_Fields field) { + if (field == null) { + throw new java.lang.IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new java.lang.IllegalStateException(); + } + + @Override + public boolean equals(java.lang.Object that) { + if (that instanceof UserAccount) return this.equals((UserAccount) that); + return false; + } + + public boolean equals(UserAccount that) { + if (that == null) return false; + if (this == that) return true; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + int hashCode = 1; + + hashCode = hashCode * 8191 + ((isSetUser()) ? 131071 : 524287); + if (isSetUser()) hashCode = hashCode * 8191 + user.hashCode(); + + hashCode = hashCode * 8191 + ((isSetAccount()) ? 131071 : 524287); + if (isSetAccount()) hashCode = hashCode * 8191 + account.hashCode(); + + return hashCode; + } + + @Override + public int compareTo(UserAccount other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = java.lang.Boolean.compare(isSetUser(), other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = java.lang.Boolean.compare(isSetAccount(), other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + @org.apache.thrift.annotation.Nullable + @Override + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + scheme(iprot).read(iprot, this); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + scheme(oprot).write(oprot, this); + } + + @Override + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("UserAccount("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (user == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'user' was not present! Struct: " + toString()); + } + if (account == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'account' was not present! Struct: " + toString()); + } + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, java.lang.ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserAccountStandardSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public UserAccountStandardScheme getScheme() { + return new UserAccountStandardScheme(); + } + } + + private static class UserAccountStandardScheme + extends org.apache.thrift.scheme.StandardScheme { + + @Override + public void read(org.apache.thrift.protocol.TProtocol iprot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + @Override + public void write(org.apache.thrift.protocol.TProtocol oprot, UserAccount struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserAccountTupleSchemeFactory + implements org.apache.thrift.scheme.SchemeFactory { + @Override + public UserAccountTupleScheme getScheme() { + return new UserAccountTupleScheme(); + } + } + + private static class UserAccountTupleScheme + extends org.apache.thrift.scheme.TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol oprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user.write(oprot); + struct.account.write(oprot); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TTupleProtocol iprot = + (org.apache.thrift.protocol.TTupleProtocol) prot; + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + + private static S scheme( + org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) + ? STANDARD_SCHEME_FACTORY + : TUPLE_SCHEME_FACTORY) + .getScheme(); + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_7_0/Account.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_7_0/Account.java new file mode 100644 index 000000000000..02ed726a8420 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_7_0/Account.java @@ -0,0 +1,413 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_7_0; + +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +public class Account + implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("Account"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField CARD_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "cardId", org.apache.thrift.protocol.TType.STRING, (short) 2); + + public String zone; // required + public String cardId; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + CARD_ID((short) 2, "cardId"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // CARD_ID + return CARD_ID; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.CARD_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "cardId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Account.class, metaDataMap); + } + + public Account() {} + + public Account(String zone, String cardId) { + this(); + this.zone = zone; + this.cardId = cardId; + } + + /** Performs a deep copy on other. */ + public Account(Account other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetCardId()) { + this.cardId = other.cardId; + } + } + + public Account deepCopy() { + return new Account(this); + } + + @Override + public void clear() { + this.zone = null; + this.cardId = null; + } + + public String getZone() { + return this.zone; + } + + public Account setZone(String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + public String getCardId() { + return this.cardId; + } + + public Account setCardId(String cardId) { + this.cardId = cardId; + return this; + } + + public void unsetCardId() { + this.cardId = null; + } + + /** Returns true if field cardId is set (has been assigned a value) and false otherwise */ + public boolean isSetCardId() { + return this.cardId != null; + } + + public void setCardIdIsSet(boolean value) { + if (!value) { + this.cardId = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((String) value); + } + break; + + case CARD_ID: + if (value == null) { + unsetCardId(); + } else { + setCardId((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case CARD_ID: + return getCardId(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case CARD_ID: + return isSetCardId(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof Account) return this.equals((Account) that); + return false; + } + + public boolean equals(Account that) { + if (that == null) return false; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_cardId = true && this.isSetCardId(); + boolean that_present_cardId = true && that.isSetCardId(); + if (this_present_cardId || that_present_cardId) { + if (!(this_present_cardId && that_present_cardId)) return false; + if (!this.cardId.equals(that.cardId)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(Account other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + Account typedOther = (Account) other; + + lastComparison = Boolean.valueOf(isSetZone()).compareTo(typedOther.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, typedOther.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetCardId()).compareTo(typedOther.isSetCardId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCardId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cardId, typedOther.cardId); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + case 1: // ZONE + if (field.type == org.apache.thrift.protocol.TType.STRING) { + this.zone = iprot.readString(); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + case 2: // CARD_ID + if (field.type == org.apache.thrift.protocol.TType.STRING) { + this.cardId = iprot.readString(); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (this.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(this.zone); + oprot.writeFieldEnd(); + } + if (this.cardId != null) { + oprot.writeFieldBegin(CARD_ID_FIELD_DESC); + oprot.writeString(this.cardId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("Account("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("cardId:"); + if (this.cardId == null) { + sb.append("null"); + } else { + sb.append(this.cardId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (zone == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'zone' was not present! Struct: " + toString()); + } + if (cardId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'cardId' was not present! Struct: " + toString()); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_7_0/ThriftService.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_7_0/ThriftService.java new file mode 100644 index 000000000000..6243d039a1d2 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_7_0/ThriftService.java @@ -0,0 +1,5884 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_7_0; + +import java.util.BitSet; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ThriftService { + + public interface Iface { + + public String sayHello(String zone, String name) throws org.apache.thrift.TException; + + public String withDelay(int delay) throws org.apache.thrift.TException; + + public String withoutArgs() throws org.apache.thrift.TException; + + public String withError() throws org.apache.thrift.TException; + + public String withCollisioin(String input) throws org.apache.thrift.TException; + + public void noReturn(int delay) throws org.apache.thrift.TException; + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException; + + public void oneWay() throws org.apache.thrift.TException; + + public void oneWayWithError() throws org.apache.thrift.TException; + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException; + } + + public interface AsyncIface { + + public void sayHello( + String zone, + String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withDelay( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withCollisioin( + String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void noReturn( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayHasArgs( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWay( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayWithError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + } + + public static class Client extends org.apache.thrift.TServiceClient implements Iface { + public static class Factory implements org.apache.thrift.TServiceClientFactory { + public Factory() {} + + public Client getClient(org.apache.thrift.protocol.TProtocol prot) { + return new Client(prot); + } + + public Client getClient( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + return new Client(iprot, oprot); + } + } + + public Client(org.apache.thrift.protocol.TProtocol prot) { + super(prot, prot); + } + + public Client( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + super(iprot, oprot); + } + + public String sayHello(String zone, String name) throws org.apache.thrift.TException { + send_sayHello(zone, name); + return recv_sayHello(); + } + + public void send_sayHello(String zone, String name) throws org.apache.thrift.TException { + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + sendBase("sayHello", args); + } + + public String recv_sayHello() throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + receiveBase(result, "sayHello"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "sayHello failed: unknown result"); + } + + public String withDelay(int delay) throws org.apache.thrift.TException { + send_withDelay(delay); + return recv_withDelay(); + } + + public void send_withDelay(int delay) throws org.apache.thrift.TException { + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + sendBase("withDelay", args); + } + + public String recv_withDelay() throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + receiveBase(result, "withDelay"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withDelay failed: unknown result"); + } + + public String withoutArgs() throws org.apache.thrift.TException { + send_withoutArgs(); + return recv_withoutArgs(); + } + + public void send_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_args args = new withoutArgs_args(); + sendBase("withoutArgs", args); + } + + public String recv_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + receiveBase(result, "withoutArgs"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withoutArgs failed: unknown result"); + } + + public String withError() throws org.apache.thrift.TException { + send_withError(); + return recv_withError(); + } + + public void send_withError() throws org.apache.thrift.TException { + withError_args args = new withError_args(); + sendBase("withError", args); + } + + public String recv_withError() throws org.apache.thrift.TException { + withError_result result = new withError_result(); + receiveBase(result, "withError"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withError failed: unknown result"); + } + + public String withCollisioin(String input) throws org.apache.thrift.TException { + send_withCollisioin(input); + return recv_withCollisioin(); + } + + public void send_withCollisioin(String input) throws org.apache.thrift.TException { + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + sendBase("withCollisioin", args); + } + + public String recv_withCollisioin() throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + receiveBase(result, "withCollisioin"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withCollisioin failed: unknown result"); + } + + public void noReturn(int delay) throws org.apache.thrift.TException { + send_noReturn(delay); + recv_noReturn(); + } + + public void send_noReturn(int delay) throws org.apache.thrift.TException { + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + sendBase("noReturn", args); + } + + public void recv_noReturn() throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + receiveBase(result, "noReturn"); + return; + } + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException { + send_oneWayHasArgs(delay); + } + + public void send_oneWayHasArgs(int delay) throws org.apache.thrift.TException { + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + sendBase("oneWayHasArgs", args); + } + + public void oneWay() throws org.apache.thrift.TException { + send_oneWay(); + } + + public void send_oneWay() throws org.apache.thrift.TException { + oneWay_args args = new oneWay_args(); + sendBase("oneWay", args); + } + + public void oneWayWithError() throws org.apache.thrift.TException { + send_oneWayWithError(); + } + + public void send_oneWayWithError() throws org.apache.thrift.TException { + oneWayWithError_args args = new oneWayWithError_args(); + sendBase("oneWayWithError", args); + } + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException { + send_data(user, account); + return recv_data(); + } + + public void send_data(User user, Account account) throws org.apache.thrift.TException { + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + sendBase("data", args); + } + + public UserAccount recv_data() throws org.apache.thrift.TException { + data_result result = new data_result(); + receiveBase(result, "data"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, "data failed: unknown result"); + } + } + + public static class AsyncClient extends org.apache.thrift.async.TAsyncClient + implements AsyncIface { + public static class Factory + implements org.apache.thrift.async.TAsyncClientFactory { + private org.apache.thrift.async.TAsyncClientManager clientManager; + private org.apache.thrift.protocol.TProtocolFactory protocolFactory; + + public Factory( + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.protocol.TProtocolFactory protocolFactory) { + this.clientManager = clientManager; + this.protocolFactory = protocolFactory; + } + + public AsyncClient getAsyncClient( + org.apache.thrift.transport.TNonblockingTransport transport) { + return new AsyncClient(protocolFactory, clientManager, transport); + } + } + + public AsyncClient( + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.transport.TNonblockingTransport transport) { + super(protocolFactory, clientManager, transport); + } + + public void sayHello( + String zone, + String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + sayHello_call method_call = + new sayHello_call(zone, name, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class sayHello_call extends org.apache.thrift.async.TAsyncMethodCall { + private String zone; + private String name; + + public sayHello_call( + String zone, + String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.zone = zone; + this.name = name; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "sayHello", org.apache.thrift.protocol.TMessageType.CALL, 0)); + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_sayHello(); + } + } + + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withDelay_call method_call = + new withDelay_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withDelay_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public withDelay_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withDelay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withDelay(); + } + } + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withoutArgs_call method_call = + new withoutArgs_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withoutArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + public withoutArgs_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withoutArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withoutArgs_args args = new withoutArgs_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withoutArgs(); + } + } + + public void withError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withError_call method_call = + new withError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withError_call extends org.apache.thrift.async.TAsyncMethodCall { + public withError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withError_args args = new withError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withError(); + } + } + + public void withCollisioin( + String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withCollisioin_call method_call = + new withCollisioin_call(input, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withCollisioin_call extends org.apache.thrift.async.TAsyncMethodCall { + private String input; + + public withCollisioin_call( + String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.input = input; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withCollisioin", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withCollisioin(); + } + } + + public void noReturn( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + noReturn_call method_call = + new noReturn_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class noReturn_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public noReturn_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "noReturn", org.apache.thrift.protocol.TMessageType.CALL, 0)); + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + (new Client(prot)).recv_noReturn(); + } + } + + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayHasArgs_call method_call = + new oneWayHasArgs_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayHasArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public oneWayHasArgs_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayHasArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWay_call method_call = + new oneWay_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWay_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWay_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + oneWay_args args = new oneWay_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void oneWayWithError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayWithError_call method_call = + new oneWayWithError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayWithError_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWayWithError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayWithError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + oneWayWithError_args args = new oneWayWithError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + data_call method_call = + new data_call(user, account, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class data_call extends org.apache.thrift.async.TAsyncMethodCall { + private User user; + private Account account; + + public data_call( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.user = user; + this.account = account; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "data", org.apache.thrift.protocol.TMessageType.CALL, 0)); + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + args.write(prot); + prot.writeMessageEnd(); + } + + public UserAccount getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_data(); + } + } + } + + public static class Processor extends org.apache.thrift.TBaseProcessor + implements org.apache.thrift.TProcessor { + private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); + + public Processor(I iface) { + super( + iface, + getProcessMap( + new HashMap< + String, + org.apache.thrift.ProcessFunction>())); + } + + protected Processor( + I iface, + Map> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + Map> + getProcessMap( + Map> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + private static class sayHello + extends org.apache.thrift.ProcessFunction { + public sayHello() { + super("sayHello"); + } + + protected sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + protected sayHello_result getResult(I iface, sayHello_args args) + throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + result.success = iface.sayHello(args.zone, args.name); + return result; + } + } + + private static class withDelay + extends org.apache.thrift.ProcessFunction { + public withDelay() { + super("withDelay"); + } + + protected withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + protected withDelay_result getResult(I iface, withDelay_args args) + throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + result.success = iface.withDelay(args.delay); + return result; + } + } + + private static class withoutArgs + extends org.apache.thrift.ProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + protected withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + protected withoutArgs_result getResult(I iface, withoutArgs_args args) + throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + result.success = iface.withoutArgs(); + return result; + } + } + + private static class withError + extends org.apache.thrift.ProcessFunction { + public withError() { + super("withError"); + } + + protected withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + protected withError_result getResult(I iface, withError_args args) + throws org.apache.thrift.TException { + withError_result result = new withError_result(); + result.success = iface.withError(); + return result; + } + } + + private static class withCollisioin + extends org.apache.thrift.ProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + protected withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + protected withCollisioin_result getResult(I iface, withCollisioin_args args) + throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + result.success = iface.withCollisioin(args.input); + return result; + } + } + + private static class noReturn + extends org.apache.thrift.ProcessFunction { + public noReturn() { + super("noReturn"); + } + + protected noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + protected noReturn_result getResult(I iface, noReturn_args args) + throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + iface.noReturn(args.delay); + return result; + } + } + + private static class oneWayHasArgs + extends org.apache.thrift.ProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + protected oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + protected org.apache.thrift.TBase getResult(I iface, oneWayHasArgs_args args) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay); + return null; + } + } + + private static class oneWay + extends org.apache.thrift.ProcessFunction { + public oneWay() { + super("oneWay"); + } + + protected oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + protected org.apache.thrift.TBase getResult(I iface, oneWay_args args) + throws org.apache.thrift.TException { + iface.oneWay(); + return null; + } + } + + private static class oneWayWithError + extends org.apache.thrift.ProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + protected oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + protected org.apache.thrift.TBase getResult(I iface, oneWayWithError_args args) + throws org.apache.thrift.TException { + iface.oneWayWithError(); + return null; + } + } + + private static class data + extends org.apache.thrift.ProcessFunction { + public data() { + super("data"); + } + + protected data_args getEmptyArgsInstance() { + return new data_args(); + } + + protected data_result getResult(I iface, data_args args) throws org.apache.thrift.TException { + data_result result = new data_result(); + result.success = iface.data(args.user, args.account); + return result; + } + } + } + + public static class sayHello_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_args"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 2); + + public String zone; // required + public String name; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + NAME((short) 2, "name"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // NAME + return NAME; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_args.class, metaDataMap); + } + + public sayHello_args() {} + + public sayHello_args(String zone, String name) { + this(); + this.zone = zone; + this.name = name; + } + + /** Performs a deep copy on other. */ + public sayHello_args(sayHello_args other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetName()) { + this.name = other.name; + } + } + + public sayHello_args deepCopy() { + return new sayHello_args(this); + } + + @Override + public void clear() { + this.zone = null; + this.name = null; + } + + public String getZone() { + return this.zone; + } + + public sayHello_args setZone(String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + public String getName() { + return this.name; + } + + public sayHello_args setName(String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((String) value); + } + break; + + case NAME: + if (value == null) { + unsetName(); + } else { + setName((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case NAME: + return getName(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case NAME: + return isSetName(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof sayHello_args) return this.equals((sayHello_args) that); + return false; + } + + public boolean equals(sayHello_args that) { + if (that == null) return false; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(sayHello_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + sayHello_args typedOther = (sayHello_args) other; + + lastComparison = Boolean.valueOf(isSetZone()).compareTo(typedOther.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, typedOther.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetName()).compareTo(typedOther.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, typedOther.name); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + case 1: // ZONE + if (field.type == org.apache.thrift.protocol.TType.STRING) { + this.zone = iprot.readString(); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + case 2: // NAME + if (field.type == org.apache.thrift.protocol.TType.STRING) { + this.name = iprot.readString(); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (this.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(this.zone); + oprot.writeFieldEnd(); + } + if (this.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(this.name); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("sayHello_args("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class sayHello_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_result.class, metaDataMap); + } + + public sayHello_result() {} + + public sayHello_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public sayHello_result(sayHello_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public sayHello_result deepCopy() { + return new sayHello_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public sayHello_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof sayHello_result) return this.equals((sayHello_result) that); + return false; + } + + public boolean equals(sayHello_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(sayHello_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + sayHello_result typedOther = (sayHello_result) other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + case 0: // SUCCESS + if (field.type == org.apache.thrift.protocol.TType.STRING) { + this.success = iprot.readString(); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + oprot.writeStructBegin(STRUCT_DESC); + + if (this.isSetSuccess()) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(this.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("sayHello_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class withDelay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private BitSet __isset_bit_vector = new BitSet(1); + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_args.class, metaDataMap); + } + + public withDelay_args() {} + + public withDelay_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public withDelay_args(withDelay_args other) { + __isset_bit_vector.clear(); + __isset_bit_vector.or(other.__isset_bit_vector); + this.delay = other.delay; + } + + public withDelay_args deepCopy() { + return new withDelay_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public withDelay_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bit_vector.clear(__DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return __isset_bit_vector.get(__DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bit_vector.set(__DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return Integer.valueOf(getDelay()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withDelay_args) return this.equals((withDelay_args) that); + return false; + } + + public boolean equals(withDelay_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withDelay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withDelay_args typedOther = (withDelay_args) other; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(typedOther.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, typedOther.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + case 1: // DELAY + if (field.type == org.apache.thrift.protocol.TType.I32) { + this.delay = iprot.readI32(); + setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(this.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withDelay_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bit_vector = new BitSet(1); + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class withDelay_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_result.class, metaDataMap); + } + + public withDelay_result() {} + + public withDelay_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withDelay_result(withDelay_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withDelay_result deepCopy() { + return new withDelay_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withDelay_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withDelay_result) return this.equals((withDelay_result) that); + return false; + } + + public boolean equals(withDelay_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withDelay_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withDelay_result typedOther = (withDelay_result) other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + case 0: // SUCCESS + if (field.type == org.apache.thrift.protocol.TType.STRING) { + this.success = iprot.readString(); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + oprot.writeStructBegin(STRUCT_DESC); + + if (this.isSetSuccess()) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(this.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withDelay_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class withoutArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_args"); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_args.class, metaDataMap); + } + + public withoutArgs_args() {} + + /** Performs a deep copy on other. */ + public withoutArgs_args(withoutArgs_args other) {} + + public withoutArgs_args deepCopy() { + return new withoutArgs_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withoutArgs_args) return this.equals((withoutArgs_args) that); + return false; + } + + public boolean equals(withoutArgs_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withoutArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withoutArgs_args typedOther = (withoutArgs_args) other; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withoutArgs_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class withoutArgs_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_result.class, metaDataMap); + } + + public withoutArgs_result() {} + + public withoutArgs_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withoutArgs_result(withoutArgs_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withoutArgs_result deepCopy() { + return new withoutArgs_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withoutArgs_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withoutArgs_result) return this.equals((withoutArgs_result) that); + return false; + } + + public boolean equals(withoutArgs_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withoutArgs_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withoutArgs_result typedOther = (withoutArgs_result) other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + case 0: // SUCCESS + if (field.type == org.apache.thrift.protocol.TType.STRING) { + this.success = iprot.readString(); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + oprot.writeStructBegin(STRUCT_DESC); + + if (this.isSetSuccess()) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(this.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withoutArgs_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class withError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_args"); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_args.class, metaDataMap); + } + + public withError_args() {} + + /** Performs a deep copy on other. */ + public withError_args(withError_args other) {} + + public withError_args deepCopy() { + return new withError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withError_args) return this.equals((withError_args) that); + return false; + } + + public boolean equals(withError_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withError_args typedOther = (withError_args) other; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class withError_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_result.class, metaDataMap); + } + + public withError_result() {} + + public withError_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withError_result(withError_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withError_result deepCopy() { + return new withError_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withError_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withError_result) return this.equals((withError_result) that); + return false; + } + + public boolean equals(withError_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withError_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withError_result typedOther = (withError_result) other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + case 0: // SUCCESS + if (field.type == org.apache.thrift.protocol.TType.STRING) { + this.success = iprot.readString(); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + oprot.writeStructBegin(STRUCT_DESC); + + if (this.isSetSuccess()) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(this.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withError_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class withCollisioin_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_args"); + + private static final org.apache.thrift.protocol.TField INPUT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "input", org.apache.thrift.protocol.TType.STRING, (short) 3333); + + public String input; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + INPUT((short) 3333, "input"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 3333: // INPUT + return INPUT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.INPUT, + new org.apache.thrift.meta_data.FieldMetaData( + "input", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_args.class, metaDataMap); + } + + public withCollisioin_args() {} + + public withCollisioin_args(String input) { + this(); + this.input = input; + } + + /** Performs a deep copy on other. */ + public withCollisioin_args(withCollisioin_args other) { + if (other.isSetInput()) { + this.input = other.input; + } + } + + public withCollisioin_args deepCopy() { + return new withCollisioin_args(this); + } + + @Override + public void clear() { + this.input = null; + } + + public String getInput() { + return this.input; + } + + public withCollisioin_args setInput(String input) { + this.input = input; + return this; + } + + public void unsetInput() { + this.input = null; + } + + /** Returns true if field input is set (has been assigned a value) and false otherwise */ + public boolean isSetInput() { + return this.input != null; + } + + public void setInputIsSet(boolean value) { + if (!value) { + this.input = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case INPUT: + if (value == null) { + unsetInput(); + } else { + setInput((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case INPUT: + return getInput(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case INPUT: + return isSetInput(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withCollisioin_args) return this.equals((withCollisioin_args) that); + return false; + } + + public boolean equals(withCollisioin_args that) { + if (that == null) return false; + + boolean this_present_input = true && this.isSetInput(); + boolean that_present_input = true && that.isSetInput(); + if (this_present_input || that_present_input) { + if (!(this_present_input && that_present_input)) return false; + if (!this.input.equals(that.input)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withCollisioin_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withCollisioin_args typedOther = (withCollisioin_args) other; + + lastComparison = Boolean.valueOf(isSetInput()).compareTo(typedOther.isSetInput()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInput()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.input, typedOther.input); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + case 3333: // INPUT + if (field.type == org.apache.thrift.protocol.TType.STRING) { + this.input = iprot.readString(); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (this.input != null) { + oprot.writeFieldBegin(INPUT_FIELD_DESC); + oprot.writeString(this.input); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withCollisioin_args("); + boolean first = true; + + sb.append("input:"); + if (this.input == null) { + sb.append("null"); + } else { + sb.append(this.input); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class withCollisioin_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_result.class, metaDataMap); + } + + public withCollisioin_result() {} + + public withCollisioin_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withCollisioin_result(withCollisioin_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withCollisioin_result deepCopy() { + return new withCollisioin_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withCollisioin_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withCollisioin_result) return this.equals((withCollisioin_result) that); + return false; + } + + public boolean equals(withCollisioin_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withCollisioin_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withCollisioin_result typedOther = (withCollisioin_result) other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + case 0: // SUCCESS + if (field.type == org.apache.thrift.protocol.TType.STRING) { + this.success = iprot.readString(); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + oprot.writeStructBegin(STRUCT_DESC); + + if (this.isSetSuccess()) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(this.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withCollisioin_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class noReturn_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private BitSet __isset_bit_vector = new BitSet(1); + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_args.class, metaDataMap); + } + + public noReturn_args() {} + + public noReturn_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public noReturn_args(noReturn_args other) { + __isset_bit_vector.clear(); + __isset_bit_vector.or(other.__isset_bit_vector); + this.delay = other.delay; + } + + public noReturn_args deepCopy() { + return new noReturn_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public noReturn_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bit_vector.clear(__DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return __isset_bit_vector.get(__DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bit_vector.set(__DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return Integer.valueOf(getDelay()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof noReturn_args) return this.equals((noReturn_args) that); + return false; + } + + public boolean equals(noReturn_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(noReturn_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + noReturn_args typedOther = (noReturn_args) other; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(typedOther.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, typedOther.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + case 1: // DELAY + if (field.type == org.apache.thrift.protocol.TType.I32) { + this.delay = iprot.readI32(); + setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(this.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("noReturn_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bit_vector = new BitSet(1); + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class noReturn_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_result"); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_result.class, metaDataMap); + } + + public noReturn_result() {} + + /** Performs a deep copy on other. */ + public noReturn_result(noReturn_result other) {} + + public noReturn_result deepCopy() { + return new noReturn_result(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof noReturn_result) return this.equals((noReturn_result) that); + return false; + } + + public boolean equals(noReturn_result that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(noReturn_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + noReturn_result typedOther = (noReturn_result) other; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + oprot.writeStructBegin(STRUCT_DESC); + + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("noReturn_result("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class oneWayHasArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayHasArgs_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private BitSet __isset_bit_vector = new BitSet(1); + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayHasArgs_args.class, metaDataMap); + } + + public oneWayHasArgs_args() {} + + public oneWayHasArgs_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public oneWayHasArgs_args(oneWayHasArgs_args other) { + __isset_bit_vector.clear(); + __isset_bit_vector.or(other.__isset_bit_vector); + this.delay = other.delay; + } + + public oneWayHasArgs_args deepCopy() { + return new oneWayHasArgs_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public oneWayHasArgs_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bit_vector.clear(__DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return __isset_bit_vector.get(__DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bit_vector.set(__DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return Integer.valueOf(getDelay()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWayHasArgs_args) return this.equals((oneWayHasArgs_args) that); + return false; + } + + public boolean equals(oneWayHasArgs_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(oneWayHasArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + oneWayHasArgs_args typedOther = (oneWayHasArgs_args) other; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(typedOther.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, typedOther.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + case 1: // DELAY + if (field.type == org.apache.thrift.protocol.TType.I32) { + this.delay = iprot.readI32(); + setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(this.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWayHasArgs_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bit_vector = new BitSet(1); + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class oneWay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWay_args"); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWay_args.class, metaDataMap); + } + + public oneWay_args() {} + + /** Performs a deep copy on other. */ + public oneWay_args(oneWay_args other) {} + + public oneWay_args deepCopy() { + return new oneWay_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWay_args) return this.equals((oneWay_args) that); + return false; + } + + public boolean equals(oneWay_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(oneWay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + oneWay_args typedOther = (oneWay_args) other; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWay_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class oneWayWithError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayWithError_args"); + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayWithError_args.class, metaDataMap); + } + + public oneWayWithError_args() {} + + /** Performs a deep copy on other. */ + public oneWayWithError_args(oneWayWithError_args other) {} + + public oneWayWithError_args deepCopy() { + return new oneWayWithError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWayWithError_args) return this.equals((oneWayWithError_args) that); + return false; + } + + public boolean equals(oneWayWithError_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(oneWayWithError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + oneWayWithError_args typedOther = (oneWayWithError_args) other; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWayWithError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class data_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_args"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + public User user; // required + public Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(data_args.class, metaDataMap); + } + + public data_args() {} + + public data_args(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public data_args(data_args other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public data_args deepCopy() { + return new data_args(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + public User getUser() { + return this.user; + } + + public data_args setUser(User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + public Account getAccount() { + return this.account; + } + + public data_args setAccount(Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof data_args) return this.equals((data_args) that); + return false; + } + + public boolean equals(data_args that) { + if (that == null) return false; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(data_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + data_args typedOther = (data_args) other; + + lastComparison = Boolean.valueOf(isSetUser()).compareTo(typedOther.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, typedOther.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAccount()).compareTo(typedOther.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, typedOther.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + case 1: // USER + if (field.type == org.apache.thrift.protocol.TType.STRUCT) { + this.user = new User(); + this.user.read(iprot); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + case 2: // ACCOUNT + if (field.type == org.apache.thrift.protocol.TType.STRUCT) { + this.account = new Account(); + this.account.read(iprot); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (this.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + this.user.write(oprot); + oprot.writeFieldEnd(); + } + if (this.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + this.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("data_args("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } + + public static class data_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRUCT, (short) 0); + + public UserAccount success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, UserAccount.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + data_result.class, metaDataMap); + } + + public data_result() {} + + public data_result(UserAccount success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public data_result(data_result other) { + if (other.isSetSuccess()) { + this.success = new UserAccount(other.success); + } + } + + public data_result deepCopy() { + return new data_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public UserAccount getSuccess() { + return this.success; + } + + public data_result setSuccess(UserAccount success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((UserAccount) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof data_result) return this.equals((data_result) that); + return false; + } + + public boolean equals(data_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(data_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + data_result typedOther = (data_result) other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + case 0: // SUCCESS + if (field.type == org.apache.thrift.protocol.TType.STRUCT) { + this.success = new UserAccount(); + this.success.read(iprot); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + oprot.writeStructBegin(STRUCT_DESC); + + if (this.isSetSuccess()) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + this.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("data_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_7_0/User.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_7_0/User.java new file mode 100644 index 000000000000..f469f22d9a84 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_7_0/User.java @@ -0,0 +1,512 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_7_0; + +import java.util.BitSet; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +public class User + implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("User"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "userId", org.apache.thrift.protocol.TType.STRING, (short) 2); + private static final org.apache.thrift.protocol.TField AGE_FIELD_DESC = + new org.apache.thrift.protocol.TField("age", org.apache.thrift.protocol.TType.I32, (short) 3); + + public String name; // required + public String userId; // required + public int age; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + NAME((short) 1, "name"), + USER_ID((short) 2, "userId"), + AGE((short) 3, "age"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // NAME + return NAME; + case 2: // USER_ID + return USER_ID; + case 3: // AGE + return AGE; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __AGE_ISSET_ID = 0; + private BitSet __isset_bit_vector = new BitSet(1); + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.USER_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "userId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.AGE, + new org.apache.thrift.meta_data.FieldMetaData( + "age", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(User.class, metaDataMap); + } + + public User() {} + + public User(String name, String userId, int age) { + this(); + this.name = name; + this.userId = userId; + this.age = age; + setAgeIsSet(true); + } + + /** Performs a deep copy on other. */ + public User(User other) { + __isset_bit_vector.clear(); + __isset_bit_vector.or(other.__isset_bit_vector); + if (other.isSetName()) { + this.name = other.name; + } + if (other.isSetUserId()) { + this.userId = other.userId; + } + this.age = other.age; + } + + public User deepCopy() { + return new User(this); + } + + @Override + public void clear() { + this.name = null; + this.userId = null; + setAgeIsSet(false); + this.age = 0; + } + + public String getName() { + return this.name; + } + + public User setName(String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public String getUserId() { + return this.userId; + } + + public User setUserId(String userId) { + this.userId = userId; + return this; + } + + public void unsetUserId() { + this.userId = null; + } + + /** Returns true if field userId is set (has been assigned a value) and false otherwise */ + public boolean isSetUserId() { + return this.userId != null; + } + + public void setUserIdIsSet(boolean value) { + if (!value) { + this.userId = null; + } + } + + public int getAge() { + return this.age; + } + + public User setAge(int age) { + this.age = age; + setAgeIsSet(true); + return this; + } + + public void unsetAge() { + __isset_bit_vector.clear(__AGE_ISSET_ID); + } + + /** Returns true if field age is set (has been assigned a value) and false otherwise */ + public boolean isSetAge() { + return __isset_bit_vector.get(__AGE_ISSET_ID); + } + + public void setAgeIsSet(boolean value) { + __isset_bit_vector.set(__AGE_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case NAME: + if (value == null) { + unsetName(); + } else { + setName((String) value); + } + break; + + case USER_ID: + if (value == null) { + unsetUserId(); + } else { + setUserId((String) value); + } + break; + + case AGE: + if (value == null) { + unsetAge(); + } else { + setAge((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case NAME: + return getName(); + + case USER_ID: + return getUserId(); + + case AGE: + return Integer.valueOf(getAge()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case NAME: + return isSetName(); + case USER_ID: + return isSetUserId(); + case AGE: + return isSetAge(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof User) return this.equals((User) that); + return false; + } + + public boolean equals(User that) { + if (that == null) return false; + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + boolean this_present_userId = true && this.isSetUserId(); + boolean that_present_userId = true && that.isSetUserId(); + if (this_present_userId || that_present_userId) { + if (!(this_present_userId && that_present_userId)) return false; + if (!this.userId.equals(that.userId)) return false; + } + + boolean this_present_age = true; + boolean that_present_age = true; + if (this_present_age || that_present_age) { + if (!(this_present_age && that_present_age)) return false; + if (this.age != that.age) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(User other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + User typedOther = (User) other; + + lastComparison = Boolean.valueOf(isSetName()).compareTo(typedOther.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, typedOther.name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetUserId()).compareTo(typedOther.isSetUserId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, typedOther.userId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAge()).compareTo(typedOther.isSetAge()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAge()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.age, typedOther.age); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + case 1: // NAME + if (field.type == org.apache.thrift.protocol.TType.STRING) { + this.name = iprot.readString(); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + case 2: // USER_ID + if (field.type == org.apache.thrift.protocol.TType.STRING) { + this.userId = iprot.readString(); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + case 3: // AGE + if (field.type == org.apache.thrift.protocol.TType.I32) { + this.age = iprot.readI32(); + setAgeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + if (!isSetAge()) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'age' was not found in serialized data! Struct: " + toString()); + } + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (this.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(this.name); + oprot.writeFieldEnd(); + } + if (this.userId != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(this.userId); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(AGE_FIELD_DESC); + oprot.writeI32(this.age); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("User("); + boolean first = true; + + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + if (!first) sb.append(", "); + sb.append("userId:"); + if (this.userId == null) { + sb.append("null"); + } else { + sb.append(this.userId); + } + first = false; + if (!first) sb.append(", "); + sb.append("age:"); + sb.append(this.age); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (name == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'name' was not present! Struct: " + toString()); + } + if (userId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'userId' was not present! Struct: " + toString()); + } + // alas, we cannot check 'age' because it's a primitive and you chose the non-beans generator. + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bit_vector = new BitSet(1); + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_7_0/UserAccount.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_7_0/UserAccount.java new file mode 100644 index 000000000000..5a62f3a2c4a8 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_7_0/UserAccount.java @@ -0,0 +1,417 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_7_0; + +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +public class UserAccount + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("UserAccount"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + public User user; // required + public Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserAccount.class, metaDataMap); + } + + public UserAccount() {} + + public UserAccount(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public UserAccount(UserAccount other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public UserAccount deepCopy() { + return new UserAccount(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + public User getUser() { + return this.user; + } + + public UserAccount setUser(User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + public Account getAccount() { + return this.account; + } + + public UserAccount setAccount(Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof UserAccount) return this.equals((UserAccount) that); + return false; + } + + public boolean equals(UserAccount that) { + if (that == null) return false; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(UserAccount other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + UserAccount typedOther = (UserAccount) other; + + lastComparison = Boolean.valueOf(isSetUser()).compareTo(typedOther.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, typedOther.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAccount()).compareTo(typedOther.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, typedOther.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField field; + iprot.readStructBegin(); + while (true) { + field = iprot.readFieldBegin(); + if (field.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (field.id) { + case 1: // USER + if (field.type == org.apache.thrift.protocol.TType.STRUCT) { + this.user = new User(); + this.user.read(iprot); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + case 2: // ACCOUNT + if (field.type == org.apache.thrift.protocol.TType.STRUCT) { + this.account = new Account(); + this.account.read(iprot); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (this.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + this.user.write(oprot); + oprot.writeFieldEnd(); + } + if (this.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + this.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("UserAccount("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (user == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'user' was not present! Struct: " + toString()); + } + if (account == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'account' was not present! Struct: " + toString()); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_8_0/Account.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_8_0/Account.java new file mode 100644 index 000000000000..4f26da2863b6 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_8_0/Account.java @@ -0,0 +1,473 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_8_0; + +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; + +public class Account + implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("Account"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField CARD_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "cardId", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new AccountStandardSchemeFactory()); + schemes.put(TupleScheme.class, new AccountTupleSchemeFactory()); + } + + public String zone; // required + public String cardId; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + CARD_ID((short) 2, "cardId"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // CARD_ID + return CARD_ID; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.CARD_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "cardId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Account.class, metaDataMap); + } + + public Account() {} + + public Account(String zone, String cardId) { + this(); + this.zone = zone; + this.cardId = cardId; + } + + /** Performs a deep copy on other. */ + public Account(Account other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetCardId()) { + this.cardId = other.cardId; + } + } + + public Account deepCopy() { + return new Account(this); + } + + @Override + public void clear() { + this.zone = null; + this.cardId = null; + } + + public String getZone() { + return this.zone; + } + + public Account setZone(String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + public String getCardId() { + return this.cardId; + } + + public Account setCardId(String cardId) { + this.cardId = cardId; + return this; + } + + public void unsetCardId() { + this.cardId = null; + } + + /** Returns true if field cardId is set (has been assigned a value) and false otherwise */ + public boolean isSetCardId() { + return this.cardId != null; + } + + public void setCardIdIsSet(boolean value) { + if (!value) { + this.cardId = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((String) value); + } + break; + + case CARD_ID: + if (value == null) { + unsetCardId(); + } else { + setCardId((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case CARD_ID: + return getCardId(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case CARD_ID: + return isSetCardId(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof Account) return this.equals((Account) that); + return false; + } + + public boolean equals(Account that) { + if (that == null) return false; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_cardId = true && this.isSetCardId(); + boolean that_present_cardId = true && that.isSetCardId(); + if (this_present_cardId || that_present_cardId) { + if (!(this_present_cardId && that_present_cardId)) return false; + if (!this.cardId.equals(that.cardId)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(Account other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + Account typedOther = (Account) other; + + lastComparison = Boolean.valueOf(isSetZone()).compareTo(typedOther.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, typedOther.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetCardId()).compareTo(typedOther.isSetCardId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCardId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cardId, typedOther.cardId); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("Account("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("cardId:"); + if (this.cardId == null) { + sb.append("null"); + } else { + sb.append(this.cardId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (zone == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'zone' was not present! Struct: " + toString()); + } + if (cardId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'cardId' was not present! Struct: " + toString()); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class AccountStandardSchemeFactory implements SchemeFactory { + public AccountStandardScheme getScheme() { + return new AccountStandardScheme(); + } + } + + private static class AccountStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // CARD_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, Account struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.cardId != null) { + oprot.writeFieldBegin(CARD_ID_FIELD_DESC); + oprot.writeString(struct.cardId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class AccountTupleSchemeFactory implements SchemeFactory { + public AccountTupleScheme getScheme() { + return new AccountTupleScheme(); + } + } + + private static class AccountTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeString(struct.zone); + oprot.writeString(struct.cardId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_8_0/ThriftService.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_8_0/ThriftService.java new file mode 100644 index 000000000000..dc8b36e44d69 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_8_0/ThriftService.java @@ -0,0 +1,6913 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_8_0; + +import java.util.BitSet; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ThriftService { + + public interface Iface { + + public String sayHello(String zone, String name) throws org.apache.thrift.TException; + + public String withDelay(int delay) throws org.apache.thrift.TException; + + public String withoutArgs() throws org.apache.thrift.TException; + + public String withError() throws org.apache.thrift.TException; + + public String withCollisioin(String input) throws org.apache.thrift.TException; + + public void noReturn(int delay) throws org.apache.thrift.TException; + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException; + + public void oneWay() throws org.apache.thrift.TException; + + public void oneWayWithError() throws org.apache.thrift.TException; + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException; + } + + public interface AsyncIface { + + public void sayHello( + String zone, + String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withDelay( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withCollisioin( + String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void noReturn( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayHasArgs( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWay( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayWithError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + } + + public static class Client extends org.apache.thrift.TServiceClient implements Iface { + public static class Factory implements org.apache.thrift.TServiceClientFactory { + public Factory() {} + + public Client getClient(org.apache.thrift.protocol.TProtocol prot) { + return new Client(prot); + } + + public Client getClient( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + return new Client(iprot, oprot); + } + } + + public Client(org.apache.thrift.protocol.TProtocol prot) { + super(prot, prot); + } + + public Client( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + super(iprot, oprot); + } + + public String sayHello(String zone, String name) throws org.apache.thrift.TException { + send_sayHello(zone, name); + return recv_sayHello(); + } + + public void send_sayHello(String zone, String name) throws org.apache.thrift.TException { + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + sendBase("sayHello", args); + } + + public String recv_sayHello() throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + receiveBase(result, "sayHello"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "sayHello failed: unknown result"); + } + + public String withDelay(int delay) throws org.apache.thrift.TException { + send_withDelay(delay); + return recv_withDelay(); + } + + public void send_withDelay(int delay) throws org.apache.thrift.TException { + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + sendBase("withDelay", args); + } + + public String recv_withDelay() throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + receiveBase(result, "withDelay"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withDelay failed: unknown result"); + } + + public String withoutArgs() throws org.apache.thrift.TException { + send_withoutArgs(); + return recv_withoutArgs(); + } + + public void send_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_args args = new withoutArgs_args(); + sendBase("withoutArgs", args); + } + + public String recv_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + receiveBase(result, "withoutArgs"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withoutArgs failed: unknown result"); + } + + public String withError() throws org.apache.thrift.TException { + send_withError(); + return recv_withError(); + } + + public void send_withError() throws org.apache.thrift.TException { + withError_args args = new withError_args(); + sendBase("withError", args); + } + + public String recv_withError() throws org.apache.thrift.TException { + withError_result result = new withError_result(); + receiveBase(result, "withError"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withError failed: unknown result"); + } + + public String withCollisioin(String input) throws org.apache.thrift.TException { + send_withCollisioin(input); + return recv_withCollisioin(); + } + + public void send_withCollisioin(String input) throws org.apache.thrift.TException { + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + sendBase("withCollisioin", args); + } + + public String recv_withCollisioin() throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + receiveBase(result, "withCollisioin"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withCollisioin failed: unknown result"); + } + + public void noReturn(int delay) throws org.apache.thrift.TException { + send_noReturn(delay); + recv_noReturn(); + } + + public void send_noReturn(int delay) throws org.apache.thrift.TException { + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + sendBase("noReturn", args); + } + + public void recv_noReturn() throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + receiveBase(result, "noReturn"); + return; + } + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException { + send_oneWayHasArgs(delay); + } + + public void send_oneWayHasArgs(int delay) throws org.apache.thrift.TException { + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + sendBase("oneWayHasArgs", args); + } + + public void oneWay() throws org.apache.thrift.TException { + send_oneWay(); + } + + public void send_oneWay() throws org.apache.thrift.TException { + oneWay_args args = new oneWay_args(); + sendBase("oneWay", args); + } + + public void oneWayWithError() throws org.apache.thrift.TException { + send_oneWayWithError(); + } + + public void send_oneWayWithError() throws org.apache.thrift.TException { + oneWayWithError_args args = new oneWayWithError_args(); + sendBase("oneWayWithError", args); + } + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException { + send_data(user, account); + return recv_data(); + } + + public void send_data(User user, Account account) throws org.apache.thrift.TException { + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + sendBase("data", args); + } + + public UserAccount recv_data() throws org.apache.thrift.TException { + data_result result = new data_result(); + receiveBase(result, "data"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, "data failed: unknown result"); + } + } + + public static class AsyncClient extends org.apache.thrift.async.TAsyncClient + implements AsyncIface { + public static class Factory + implements org.apache.thrift.async.TAsyncClientFactory { + private org.apache.thrift.async.TAsyncClientManager clientManager; + private org.apache.thrift.protocol.TProtocolFactory protocolFactory; + + public Factory( + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.protocol.TProtocolFactory protocolFactory) { + this.clientManager = clientManager; + this.protocolFactory = protocolFactory; + } + + public AsyncClient getAsyncClient( + org.apache.thrift.transport.TNonblockingTransport transport) { + return new AsyncClient(protocolFactory, clientManager, transport); + } + } + + public AsyncClient( + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.transport.TNonblockingTransport transport) { + super(protocolFactory, clientManager, transport); + } + + public void sayHello( + String zone, + String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + sayHello_call method_call = + new sayHello_call(zone, name, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class sayHello_call extends org.apache.thrift.async.TAsyncMethodCall { + private String zone; + private String name; + + public sayHello_call( + String zone, + String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.zone = zone; + this.name = name; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "sayHello", org.apache.thrift.protocol.TMessageType.CALL, 0)); + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_sayHello(); + } + } + + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withDelay_call method_call = + new withDelay_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withDelay_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public withDelay_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withDelay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withDelay(); + } + } + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withoutArgs_call method_call = + new withoutArgs_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withoutArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + public withoutArgs_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withoutArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withoutArgs_args args = new withoutArgs_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withoutArgs(); + } + } + + public void withError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withError_call method_call = + new withError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withError_call extends org.apache.thrift.async.TAsyncMethodCall { + public withError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withError_args args = new withError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withError(); + } + } + + public void withCollisioin( + String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withCollisioin_call method_call = + new withCollisioin_call(input, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withCollisioin_call extends org.apache.thrift.async.TAsyncMethodCall { + private String input; + + public withCollisioin_call( + String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.input = input; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withCollisioin", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withCollisioin(); + } + } + + public void noReturn( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + noReturn_call method_call = + new noReturn_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class noReturn_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public noReturn_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "noReturn", org.apache.thrift.protocol.TMessageType.CALL, 0)); + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws org.apache.thrift.TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + (new Client(prot)).recv_noReturn(); + } + } + + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayHasArgs_call method_call = + new oneWayHasArgs_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayHasArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public oneWayHasArgs_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayHasArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws org.apache.thrift.TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWay_call method_call = + new oneWay_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWay_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWay_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + oneWay_args args = new oneWay_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws org.apache.thrift.TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void oneWayWithError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayWithError_call method_call = + new oneWayWithError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayWithError_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWayWithError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayWithError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + oneWayWithError_args args = new oneWayWithError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws org.apache.thrift.TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + data_call method_call = + new data_call(user, account, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class data_call extends org.apache.thrift.async.TAsyncMethodCall { + private User user; + private Account account; + + public data_call( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.user = user; + this.account = account; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "data", org.apache.thrift.protocol.TMessageType.CALL, 0)); + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + args.write(prot); + prot.writeMessageEnd(); + } + + public UserAccount getResult() throws org.apache.thrift.TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_data(); + } + } + } + + public static class Processor extends org.apache.thrift.TBaseProcessor + implements org.apache.thrift.TProcessor { + private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); + + public Processor(I iface) { + super( + iface, + getProcessMap( + new HashMap< + String, + org.apache.thrift.ProcessFunction>())); + } + + protected Processor( + I iface, + Map> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + Map> + getProcessMap( + Map> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + private static class sayHello + extends org.apache.thrift.ProcessFunction { + public sayHello() { + super("sayHello"); + } + + protected sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + protected sayHello_result getResult(I iface, sayHello_args args) + throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + result.success = iface.sayHello(args.zone, args.name); + return result; + } + } + + private static class withDelay + extends org.apache.thrift.ProcessFunction { + public withDelay() { + super("withDelay"); + } + + protected withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + protected withDelay_result getResult(I iface, withDelay_args args) + throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + result.success = iface.withDelay(args.delay); + return result; + } + } + + private static class withoutArgs + extends org.apache.thrift.ProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + protected withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + protected withoutArgs_result getResult(I iface, withoutArgs_args args) + throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + result.success = iface.withoutArgs(); + return result; + } + } + + private static class withError + extends org.apache.thrift.ProcessFunction { + public withError() { + super("withError"); + } + + protected withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + protected withError_result getResult(I iface, withError_args args) + throws org.apache.thrift.TException { + withError_result result = new withError_result(); + result.success = iface.withError(); + return result; + } + } + + private static class withCollisioin + extends org.apache.thrift.ProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + protected withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + protected withCollisioin_result getResult(I iface, withCollisioin_args args) + throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + result.success = iface.withCollisioin(args.input); + return result; + } + } + + private static class noReturn + extends org.apache.thrift.ProcessFunction { + public noReturn() { + super("noReturn"); + } + + protected noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + protected noReturn_result getResult(I iface, noReturn_args args) + throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + iface.noReturn(args.delay); + return result; + } + } + + private static class oneWayHasArgs + extends org.apache.thrift.ProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + protected oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + protected org.apache.thrift.TBase getResult(I iface, oneWayHasArgs_args args) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay); + return null; + } + } + + private static class oneWay + extends org.apache.thrift.ProcessFunction { + public oneWay() { + super("oneWay"); + } + + protected oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + protected org.apache.thrift.TBase getResult(I iface, oneWay_args args) + throws org.apache.thrift.TException { + iface.oneWay(); + return null; + } + } + + private static class oneWayWithError + extends org.apache.thrift.ProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + protected oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + protected org.apache.thrift.TBase getResult(I iface, oneWayWithError_args args) + throws org.apache.thrift.TException { + iface.oneWayWithError(); + return null; + } + } + + private static class data + extends org.apache.thrift.ProcessFunction { + public data() { + super("data"); + } + + protected data_args getEmptyArgsInstance() { + return new data_args(); + } + + protected data_result getResult(I iface, data_args args) throws org.apache.thrift.TException { + data_result result = new data_result(); + result.success = iface.data(args.user, args.account); + return result; + } + } + } + + public static class sayHello_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_args"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new sayHello_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new sayHello_argsTupleSchemeFactory()); + } + + public String zone; // required + public String name; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + NAME((short) 2, "name"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // NAME + return NAME; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_args.class, metaDataMap); + } + + public sayHello_args() {} + + public sayHello_args(String zone, String name) { + this(); + this.zone = zone; + this.name = name; + } + + /** Performs a deep copy on other. */ + public sayHello_args(sayHello_args other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetName()) { + this.name = other.name; + } + } + + public sayHello_args deepCopy() { + return new sayHello_args(this); + } + + @Override + public void clear() { + this.zone = null; + this.name = null; + } + + public String getZone() { + return this.zone; + } + + public sayHello_args setZone(String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + public String getName() { + return this.name; + } + + public sayHello_args setName(String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((String) value); + } + break; + + case NAME: + if (value == null) { + unsetName(); + } else { + setName((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case NAME: + return getName(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case NAME: + return isSetName(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof sayHello_args) return this.equals((sayHello_args) that); + return false; + } + + public boolean equals(sayHello_args that) { + if (that == null) return false; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(sayHello_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + sayHello_args typedOther = (sayHello_args) other; + + lastComparison = Boolean.valueOf(isSetZone()).compareTo(typedOther.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, typedOther.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetName()).compareTo(typedOther.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, typedOther.name); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("sayHello_args("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_argsStandardSchemeFactory implements SchemeFactory { + public sayHello_argsStandardScheme getScheme() { + return new sayHello_argsStandardScheme(); + } + } + + private static class sayHello_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_argsTupleSchemeFactory implements SchemeFactory { + public sayHello_argsTupleScheme getScheme() { + return new sayHello_argsTupleScheme(); + } + } + + private static class sayHello_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetZone()) { + optionals.set(0); + } + if (struct.isSetName()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetZone()) { + oprot.writeString(struct.zone); + } + if (struct.isSetName()) { + oprot.writeString(struct.name); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } + if (incoming.get(1)) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } + } + } + } + + public static class sayHello_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new sayHello_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new sayHello_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_result.class, metaDataMap); + } + + public sayHello_result() {} + + public sayHello_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public sayHello_result(sayHello_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public sayHello_result deepCopy() { + return new sayHello_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public sayHello_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof sayHello_result) return this.equals((sayHello_result) that); + return false; + } + + public boolean equals(sayHello_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(sayHello_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + sayHello_result typedOther = (sayHello_result) other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("sayHello_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_resultStandardSchemeFactory implements SchemeFactory { + public sayHello_resultStandardScheme getScheme() { + return new sayHello_resultStandardScheme(); + } + } + + private static class sayHello_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_resultTupleSchemeFactory implements SchemeFactory { + public sayHello_resultTupleScheme getScheme() { + return new sayHello_resultTupleScheme(); + } + } + + private static class sayHello_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withDelay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withDelay_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withDelay_argsTupleSchemeFactory()); + } + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private BitSet __isset_bit_vector = new BitSet(1); + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_args.class, metaDataMap); + } + + public withDelay_args() {} + + public withDelay_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public withDelay_args(withDelay_args other) { + __isset_bit_vector.clear(); + __isset_bit_vector.or(other.__isset_bit_vector); + this.delay = other.delay; + } + + public withDelay_args deepCopy() { + return new withDelay_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public withDelay_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bit_vector.clear(__DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return __isset_bit_vector.get(__DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bit_vector.set(__DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return Integer.valueOf(getDelay()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withDelay_args) return this.equals((withDelay_args) that); + return false; + } + + public boolean equals(withDelay_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withDelay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withDelay_args typedOther = (withDelay_args) other; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(typedOther.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, typedOther.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withDelay_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bit_vector = new BitSet(1); + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_argsStandardSchemeFactory implements SchemeFactory { + public withDelay_argsStandardScheme getScheme() { + return new withDelay_argsStandardScheme(); + } + } + + private static class withDelay_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_argsTupleSchemeFactory implements SchemeFactory { + public withDelay_argsTupleScheme getScheme() { + return new withDelay_argsTupleScheme(); + } + } + + private static class withDelay_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + } + + public static class withDelay_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withDelay_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withDelay_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_result.class, metaDataMap); + } + + public withDelay_result() {} + + public withDelay_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withDelay_result(withDelay_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withDelay_result deepCopy() { + return new withDelay_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withDelay_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withDelay_result) return this.equals((withDelay_result) that); + return false; + } + + public boolean equals(withDelay_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withDelay_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withDelay_result typedOther = (withDelay_result) other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withDelay_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_resultStandardSchemeFactory implements SchemeFactory { + public withDelay_resultStandardScheme getScheme() { + return new withDelay_resultStandardScheme(); + } + } + + private static class withDelay_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_resultTupleSchemeFactory implements SchemeFactory { + public withDelay_resultTupleScheme getScheme() { + return new withDelay_resultTupleScheme(); + } + } + + private static class withDelay_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withoutArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withoutArgs_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withoutArgs_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_args.class, metaDataMap); + } + + public withoutArgs_args() {} + + /** Performs a deep copy on other. */ + public withoutArgs_args(withoutArgs_args other) {} + + public withoutArgs_args deepCopy() { + return new withoutArgs_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withoutArgs_args) return this.equals((withoutArgs_args) that); + return false; + } + + public boolean equals(withoutArgs_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withoutArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withoutArgs_args typedOther = (withoutArgs_args) other; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withoutArgs_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_argsStandardSchemeFactory implements SchemeFactory { + public withoutArgs_argsStandardScheme getScheme() { + return new withoutArgs_argsStandardScheme(); + } + } + + private static class withoutArgs_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_argsTupleSchemeFactory implements SchemeFactory { + public withoutArgs_argsTupleScheme getScheme() { + return new withoutArgs_argsTupleScheme(); + } + } + + private static class withoutArgs_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class withoutArgs_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withoutArgs_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withoutArgs_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_result.class, metaDataMap); + } + + public withoutArgs_result() {} + + public withoutArgs_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withoutArgs_result(withoutArgs_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withoutArgs_result deepCopy() { + return new withoutArgs_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withoutArgs_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withoutArgs_result) return this.equals((withoutArgs_result) that); + return false; + } + + public boolean equals(withoutArgs_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withoutArgs_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withoutArgs_result typedOther = (withoutArgs_result) other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withoutArgs_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_resultStandardSchemeFactory implements SchemeFactory { + public withoutArgs_resultStandardScheme getScheme() { + return new withoutArgs_resultStandardScheme(); + } + } + + private static class withoutArgs_resultStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_resultTupleSchemeFactory implements SchemeFactory { + public withoutArgs_resultTupleScheme getScheme() { + return new withoutArgs_resultTupleScheme(); + } + } + + private static class withoutArgs_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withError_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withError_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_args.class, metaDataMap); + } + + public withError_args() {} + + /** Performs a deep copy on other. */ + public withError_args(withError_args other) {} + + public withError_args deepCopy() { + return new withError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withError_args) return this.equals((withError_args) that); + return false; + } + + public boolean equals(withError_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withError_args typedOther = (withError_args) other; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_argsStandardSchemeFactory implements SchemeFactory { + public withError_argsStandardScheme getScheme() { + return new withError_argsStandardScheme(); + } + } + + private static class withError_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_argsTupleSchemeFactory implements SchemeFactory { + public withError_argsTupleScheme getScheme() { + return new withError_argsTupleScheme(); + } + } + + private static class withError_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class withError_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withError_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withError_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_result.class, metaDataMap); + } + + public withError_result() {} + + public withError_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withError_result(withError_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withError_result deepCopy() { + return new withError_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withError_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withError_result) return this.equals((withError_result) that); + return false; + } + + public boolean equals(withError_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withError_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withError_result typedOther = (withError_result) other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withError_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_resultStandardSchemeFactory implements SchemeFactory { + public withError_resultStandardScheme getScheme() { + return new withError_resultStandardScheme(); + } + } + + private static class withError_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_resultTupleSchemeFactory implements SchemeFactory { + public withError_resultTupleScheme getScheme() { + return new withError_resultTupleScheme(); + } + } + + private static class withError_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withCollisioin_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_args"); + + private static final org.apache.thrift.protocol.TField INPUT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "input", org.apache.thrift.protocol.TType.STRING, (short) 3333); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withCollisioin_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withCollisioin_argsTupleSchemeFactory()); + } + + public String input; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + INPUT((short) 3333, "input"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 3333: // INPUT + return INPUT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.INPUT, + new org.apache.thrift.meta_data.FieldMetaData( + "input", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_args.class, metaDataMap); + } + + public withCollisioin_args() {} + + public withCollisioin_args(String input) { + this(); + this.input = input; + } + + /** Performs a deep copy on other. */ + public withCollisioin_args(withCollisioin_args other) { + if (other.isSetInput()) { + this.input = other.input; + } + } + + public withCollisioin_args deepCopy() { + return new withCollisioin_args(this); + } + + @Override + public void clear() { + this.input = null; + } + + public String getInput() { + return this.input; + } + + public withCollisioin_args setInput(String input) { + this.input = input; + return this; + } + + public void unsetInput() { + this.input = null; + } + + /** Returns true if field input is set (has been assigned a value) and false otherwise */ + public boolean isSetInput() { + return this.input != null; + } + + public void setInputIsSet(boolean value) { + if (!value) { + this.input = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case INPUT: + if (value == null) { + unsetInput(); + } else { + setInput((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case INPUT: + return getInput(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case INPUT: + return isSetInput(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withCollisioin_args) return this.equals((withCollisioin_args) that); + return false; + } + + public boolean equals(withCollisioin_args that) { + if (that == null) return false; + + boolean this_present_input = true && this.isSetInput(); + boolean that_present_input = true && that.isSetInput(); + if (this_present_input || that_present_input) { + if (!(this_present_input && that_present_input)) return false; + if (!this.input.equals(that.input)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withCollisioin_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withCollisioin_args typedOther = (withCollisioin_args) other; + + lastComparison = Boolean.valueOf(isSetInput()).compareTo(typedOther.isSetInput()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInput()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.input, typedOther.input); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withCollisioin_args("); + boolean first = true; + + sb.append("input:"); + if (this.input == null) { + sb.append("null"); + } else { + sb.append(this.input); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_argsStandardSchemeFactory implements SchemeFactory { + public withCollisioin_argsStandardScheme getScheme() { + return new withCollisioin_argsStandardScheme(); + } + } + + private static class withCollisioin_argsStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 3333: // INPUT + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.input != null) { + oprot.writeFieldBegin(INPUT_FIELD_DESC); + oprot.writeString(struct.input); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_argsTupleSchemeFactory implements SchemeFactory { + public withCollisioin_argsTupleScheme getScheme() { + return new withCollisioin_argsTupleScheme(); + } + } + + private static class withCollisioin_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetInput()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetInput()) { + oprot.writeString(struct.input); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } + } + } + } + + public static class withCollisioin_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withCollisioin_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withCollisioin_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_result.class, metaDataMap); + } + + public withCollisioin_result() {} + + public withCollisioin_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withCollisioin_result(withCollisioin_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withCollisioin_result deepCopy() { + return new withCollisioin_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withCollisioin_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withCollisioin_result) return this.equals((withCollisioin_result) that); + return false; + } + + public boolean equals(withCollisioin_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withCollisioin_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withCollisioin_result typedOther = (withCollisioin_result) other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withCollisioin_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_resultStandardSchemeFactory implements SchemeFactory { + public withCollisioin_resultStandardScheme getScheme() { + return new withCollisioin_resultStandardScheme(); + } + } + + private static class withCollisioin_resultStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_resultTupleSchemeFactory implements SchemeFactory { + public withCollisioin_resultTupleScheme getScheme() { + return new withCollisioin_resultTupleScheme(); + } + } + + private static class withCollisioin_resultTupleScheme + extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class noReturn_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new noReturn_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new noReturn_argsTupleSchemeFactory()); + } + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private BitSet __isset_bit_vector = new BitSet(1); + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_args.class, metaDataMap); + } + + public noReturn_args() {} + + public noReturn_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public noReturn_args(noReturn_args other) { + __isset_bit_vector.clear(); + __isset_bit_vector.or(other.__isset_bit_vector); + this.delay = other.delay; + } + + public noReturn_args deepCopy() { + return new noReturn_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public noReturn_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bit_vector.clear(__DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return __isset_bit_vector.get(__DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bit_vector.set(__DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return Integer.valueOf(getDelay()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof noReturn_args) return this.equals((noReturn_args) that); + return false; + } + + public boolean equals(noReturn_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(noReturn_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + noReturn_args typedOther = (noReturn_args) other; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(typedOther.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, typedOther.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("noReturn_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bit_vector = new BitSet(1); + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_argsStandardSchemeFactory implements SchemeFactory { + public noReturn_argsStandardScheme getScheme() { + return new noReturn_argsStandardScheme(); + } + } + + private static class noReturn_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_argsTupleSchemeFactory implements SchemeFactory { + public noReturn_argsTupleScheme getScheme() { + return new noReturn_argsTupleScheme(); + } + } + + private static class noReturn_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + } + + public static class noReturn_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_result"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new noReturn_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new noReturn_resultTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_result.class, metaDataMap); + } + + public noReturn_result() {} + + /** Performs a deep copy on other. */ + public noReturn_result(noReturn_result other) {} + + public noReturn_result deepCopy() { + return new noReturn_result(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof noReturn_result) return this.equals((noReturn_result) that); + return false; + } + + public boolean equals(noReturn_result that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(noReturn_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + noReturn_result typedOther = (noReturn_result) other; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("noReturn_result("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_resultStandardSchemeFactory implements SchemeFactory { + public noReturn_resultStandardScheme getScheme() { + return new noReturn_resultStandardScheme(); + } + } + + private static class noReturn_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_resultTupleSchemeFactory implements SchemeFactory { + public noReturn_resultTupleScheme getScheme() { + return new noReturn_resultTupleScheme(); + } + } + + private static class noReturn_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class oneWayHasArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayHasArgs_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new oneWayHasArgs_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new oneWayHasArgs_argsTupleSchemeFactory()); + } + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private BitSet __isset_bit_vector = new BitSet(1); + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayHasArgs_args.class, metaDataMap); + } + + public oneWayHasArgs_args() {} + + public oneWayHasArgs_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public oneWayHasArgs_args(oneWayHasArgs_args other) { + __isset_bit_vector.clear(); + __isset_bit_vector.or(other.__isset_bit_vector); + this.delay = other.delay; + } + + public oneWayHasArgs_args deepCopy() { + return new oneWayHasArgs_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public oneWayHasArgs_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bit_vector.clear(__DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return __isset_bit_vector.get(__DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bit_vector.set(__DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return Integer.valueOf(getDelay()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWayHasArgs_args) return this.equals((oneWayHasArgs_args) that); + return false; + } + + public boolean equals(oneWayHasArgs_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(oneWayHasArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + oneWayHasArgs_args typedOther = (oneWayHasArgs_args) other; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(typedOther.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, typedOther.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWayHasArgs_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bit_vector = new BitSet(1); + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayHasArgs_argsStandardSchemeFactory implements SchemeFactory { + public oneWayHasArgs_argsStandardScheme getScheme() { + return new oneWayHasArgs_argsStandardScheme(); + } + } + + private static class oneWayHasArgs_argsStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayHasArgs_argsTupleSchemeFactory implements SchemeFactory { + public oneWayHasArgs_argsTupleScheme getScheme() { + return new oneWayHasArgs_argsTupleScheme(); + } + } + + private static class oneWayHasArgs_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + } + + public static class oneWay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWay_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new oneWay_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new oneWay_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWay_args.class, metaDataMap); + } + + public oneWay_args() {} + + /** Performs a deep copy on other. */ + public oneWay_args(oneWay_args other) {} + + public oneWay_args deepCopy() { + return new oneWay_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWay_args) return this.equals((oneWay_args) that); + return false; + } + + public boolean equals(oneWay_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(oneWay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + oneWay_args typedOther = (oneWay_args) other; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWay_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWay_argsStandardSchemeFactory implements SchemeFactory { + public oneWay_argsStandardScheme getScheme() { + return new oneWay_argsStandardScheme(); + } + } + + private static class oneWay_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWay_argsTupleSchemeFactory implements SchemeFactory { + public oneWay_argsTupleScheme getScheme() { + return new oneWay_argsTupleScheme(); + } + } + + private static class oneWay_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class oneWayWithError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayWithError_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new oneWayWithError_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new oneWayWithError_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayWithError_args.class, metaDataMap); + } + + public oneWayWithError_args() {} + + /** Performs a deep copy on other. */ + public oneWayWithError_args(oneWayWithError_args other) {} + + public oneWayWithError_args deepCopy() { + return new oneWayWithError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWayWithError_args) return this.equals((oneWayWithError_args) that); + return false; + } + + public boolean equals(oneWayWithError_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(oneWayWithError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + oneWayWithError_args typedOther = (oneWayWithError_args) other; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWayWithError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayWithError_argsStandardSchemeFactory implements SchemeFactory { + public oneWayWithError_argsStandardScheme getScheme() { + return new oneWayWithError_argsStandardScheme(); + } + } + + private static class oneWayWithError_argsStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayWithError_argsTupleSchemeFactory implements SchemeFactory { + public oneWayWithError_argsTupleScheme getScheme() { + return new oneWayWithError_argsTupleScheme(); + } + } + + private static class oneWayWithError_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class data_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_args"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new data_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new data_argsTupleSchemeFactory()); + } + + public User user; // required + public Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(data_args.class, metaDataMap); + } + + public data_args() {} + + public data_args(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public data_args(data_args other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public data_args deepCopy() { + return new data_args(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + public User getUser() { + return this.user; + } + + public data_args setUser(User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + public Account getAccount() { + return this.account; + } + + public data_args setAccount(Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof data_args) return this.equals((data_args) that); + return false; + } + + public boolean equals(data_args that) { + if (that == null) return false; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(data_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + data_args typedOther = (data_args) other; + + lastComparison = Boolean.valueOf(isSetUser()).compareTo(typedOther.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, typedOther.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAccount()).compareTo(typedOther.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, typedOther.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("data_args("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_argsStandardSchemeFactory implements SchemeFactory { + public data_argsStandardScheme getScheme() { + return new data_argsStandardScheme(); + } + } + + private static class data_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_argsTupleSchemeFactory implements SchemeFactory { + public data_argsTupleScheme getScheme() { + return new data_argsTupleScheme(); + } + } + + private static class data_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetUser()) { + optionals.set(0); + } + if (struct.isSetAccount()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetUser()) { + struct.user.write(oprot); + } + if (struct.isSetAccount()) { + struct.account.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } + if (incoming.get(1)) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + } + } + + public static class data_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRUCT, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new data_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new data_resultTupleSchemeFactory()); + } + + public UserAccount success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, UserAccount.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + data_result.class, metaDataMap); + } + + public data_result() {} + + public data_result(UserAccount success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public data_result(data_result other) { + if (other.isSetSuccess()) { + this.success = new UserAccount(other.success); + } + } + + public data_result deepCopy() { + return new data_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public UserAccount getSuccess() { + return this.success; + } + + public data_result setSuccess(UserAccount success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((UserAccount) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof data_result) return this.equals((data_result) that); + return false; + } + + public boolean equals(data_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(data_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + data_result typedOther = (data_result) other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("data_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_resultStandardSchemeFactory implements SchemeFactory { + public data_resultStandardScheme getScheme() { + return new data_resultStandardScheme(); + } + } + + private static class data_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_resultTupleSchemeFactory implements SchemeFactory { + public data_resultTupleScheme getScheme() { + return new data_resultTupleScheme(); + } + } + + private static class data_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_8_0/User.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_8_0/User.java new file mode 100644 index 000000000000..8268068fbf2f --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_8_0/User.java @@ -0,0 +1,575 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_8_0; + +import java.util.BitSet; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; + +public class User + implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("User"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "userId", org.apache.thrift.protocol.TType.STRING, (short) 2); + private static final org.apache.thrift.protocol.TField AGE_FIELD_DESC = + new org.apache.thrift.protocol.TField("age", org.apache.thrift.protocol.TType.I32, (short) 3); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new UserStandardSchemeFactory()); + schemes.put(TupleScheme.class, new UserTupleSchemeFactory()); + } + + public String name; // required + public String userId; // required + public int age; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + NAME((short) 1, "name"), + USER_ID((short) 2, "userId"), + AGE((short) 3, "age"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // NAME + return NAME; + case 2: // USER_ID + return USER_ID; + case 3: // AGE + return AGE; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __AGE_ISSET_ID = 0; + private BitSet __isset_bit_vector = new BitSet(1); + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.USER_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "userId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.AGE, + new org.apache.thrift.meta_data.FieldMetaData( + "age", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(User.class, metaDataMap); + } + + public User() {} + + public User(String name, String userId, int age) { + this(); + this.name = name; + this.userId = userId; + this.age = age; + setAgeIsSet(true); + } + + /** Performs a deep copy on other. */ + public User(User other) { + __isset_bit_vector.clear(); + __isset_bit_vector.or(other.__isset_bit_vector); + if (other.isSetName()) { + this.name = other.name; + } + if (other.isSetUserId()) { + this.userId = other.userId; + } + this.age = other.age; + } + + public User deepCopy() { + return new User(this); + } + + @Override + public void clear() { + this.name = null; + this.userId = null; + setAgeIsSet(false); + this.age = 0; + } + + public String getName() { + return this.name; + } + + public User setName(String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public String getUserId() { + return this.userId; + } + + public User setUserId(String userId) { + this.userId = userId; + return this; + } + + public void unsetUserId() { + this.userId = null; + } + + /** Returns true if field userId is set (has been assigned a value) and false otherwise */ + public boolean isSetUserId() { + return this.userId != null; + } + + public void setUserIdIsSet(boolean value) { + if (!value) { + this.userId = null; + } + } + + public int getAge() { + return this.age; + } + + public User setAge(int age) { + this.age = age; + setAgeIsSet(true); + return this; + } + + public void unsetAge() { + __isset_bit_vector.clear(__AGE_ISSET_ID); + } + + /** Returns true if field age is set (has been assigned a value) and false otherwise */ + public boolean isSetAge() { + return __isset_bit_vector.get(__AGE_ISSET_ID); + } + + public void setAgeIsSet(boolean value) { + __isset_bit_vector.set(__AGE_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case NAME: + if (value == null) { + unsetName(); + } else { + setName((String) value); + } + break; + + case USER_ID: + if (value == null) { + unsetUserId(); + } else { + setUserId((String) value); + } + break; + + case AGE: + if (value == null) { + unsetAge(); + } else { + setAge((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case NAME: + return getName(); + + case USER_ID: + return getUserId(); + + case AGE: + return Integer.valueOf(getAge()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case NAME: + return isSetName(); + case USER_ID: + return isSetUserId(); + case AGE: + return isSetAge(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof User) return this.equals((User) that); + return false; + } + + public boolean equals(User that) { + if (that == null) return false; + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + boolean this_present_userId = true && this.isSetUserId(); + boolean that_present_userId = true && that.isSetUserId(); + if (this_present_userId || that_present_userId) { + if (!(this_present_userId && that_present_userId)) return false; + if (!this.userId.equals(that.userId)) return false; + } + + boolean this_present_age = true; + boolean that_present_age = true; + if (this_present_age || that_present_age) { + if (!(this_present_age && that_present_age)) return false; + if (this.age != that.age) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(User other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + User typedOther = (User) other; + + lastComparison = Boolean.valueOf(isSetName()).compareTo(typedOther.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, typedOther.name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetUserId()).compareTo(typedOther.isSetUserId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, typedOther.userId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAge()).compareTo(typedOther.isSetAge()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAge()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.age, typedOther.age); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("User("); + boolean first = true; + + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + if (!first) sb.append(", "); + sb.append("userId:"); + if (this.userId == null) { + sb.append("null"); + } else { + sb.append(this.userId); + } + first = false; + if (!first) sb.append(", "); + sb.append("age:"); + sb.append(this.age); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (name == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'name' was not present! Struct: " + toString()); + } + if (userId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'userId' was not present! Struct: " + toString()); + } + // alas, we cannot check 'age' because it's a primitive and you chose the non-beans generator. + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bit_vector = new BitSet(1); + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserStandardSchemeFactory implements SchemeFactory { + public UserStandardScheme getScheme() { + return new UserStandardScheme(); + } + } + + private static class UserStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // AGE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + if (!struct.isSetAge()) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'age' was not found in serialized data! Struct: " + toString()); + } + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, User struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + if (struct.userId != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userId); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(AGE_FIELD_DESC); + oprot.writeI32(struct.age); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserTupleSchemeFactory implements SchemeFactory { + public UserTupleScheme getScheme() { + return new UserTupleScheme(); + } + } + + private static class UserTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeString(struct.name); + oprot.writeString(struct.userId); + oprot.writeI32(struct.age); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.name = iprot.readString(); + struct.setNameIsSet(true); + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_8_0/UserAccount.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_8_0/UserAccount.java new file mode 100644 index 000000000000..dcecdd03f2af --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_8_0/UserAccount.java @@ -0,0 +1,479 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_8_0; + +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; + +public class UserAccount + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("UserAccount"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new UserAccountStandardSchemeFactory()); + schemes.put(TupleScheme.class, new UserAccountTupleSchemeFactory()); + } + + public User user; // required + public Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserAccount.class, metaDataMap); + } + + public UserAccount() {} + + public UserAccount(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public UserAccount(UserAccount other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public UserAccount deepCopy() { + return new UserAccount(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + public User getUser() { + return this.user; + } + + public UserAccount setUser(User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + public Account getAccount() { + return this.account; + } + + public UserAccount setAccount(Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof UserAccount) return this.equals((UserAccount) that); + return false; + } + + public boolean equals(UserAccount that) { + if (that == null) return false; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(UserAccount other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + UserAccount typedOther = (UserAccount) other; + + lastComparison = Boolean.valueOf(isSetUser()).compareTo(typedOther.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, typedOther.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAccount()).compareTo(typedOther.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, typedOther.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("UserAccount("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (user == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'user' was not present! Struct: " + toString()); + } + if (account == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'account' was not present! Struct: " + toString()); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserAccountStandardSchemeFactory implements SchemeFactory { + public UserAccountStandardScheme getScheme() { + return new UserAccountStandardScheme(); + } + } + + private static class UserAccountStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, UserAccount struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserAccountTupleSchemeFactory implements SchemeFactory { + public UserAccountTupleScheme getScheme() { + return new UserAccountTupleScheme(); + } + } + + private static class UserAccountTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + struct.user.write(oprot); + struct.account.write(oprot); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_0/Account.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_0/Account.java new file mode 100644 index 000000000000..f87ae68bf9be --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_0/Account.java @@ -0,0 +1,471 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_9_0; + +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; +import org.apache.thrift.TException; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; + +public class Account + implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("Account"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField CARD_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "cardId", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new AccountStandardSchemeFactory()); + schemes.put(TupleScheme.class, new AccountTupleSchemeFactory()); + } + + public String zone; // required + public String cardId; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + CARD_ID((short) 2, "cardId"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // CARD_ID + return CARD_ID; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.CARD_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "cardId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Account.class, metaDataMap); + } + + public Account() {} + + public Account(String zone, String cardId) { + this(); + this.zone = zone; + this.cardId = cardId; + } + + /** Performs a deep copy on other. */ + public Account(Account other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetCardId()) { + this.cardId = other.cardId; + } + } + + public Account deepCopy() { + return new Account(this); + } + + @Override + public void clear() { + this.zone = null; + this.cardId = null; + } + + public String getZone() { + return this.zone; + } + + public Account setZone(String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + public String getCardId() { + return this.cardId; + } + + public Account setCardId(String cardId) { + this.cardId = cardId; + return this; + } + + public void unsetCardId() { + this.cardId = null; + } + + /** Returns true if field cardId is set (has been assigned a value) and false otherwise */ + public boolean isSetCardId() { + return this.cardId != null; + } + + public void setCardIdIsSet(boolean value) { + if (!value) { + this.cardId = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((String) value); + } + break; + + case CARD_ID: + if (value == null) { + unsetCardId(); + } else { + setCardId((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case CARD_ID: + return getCardId(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case CARD_ID: + return isSetCardId(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof Account) return this.equals((Account) that); + return false; + } + + public boolean equals(Account that) { + if (that == null) return false; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_cardId = true && this.isSetCardId(); + boolean that_present_cardId = true && that.isSetCardId(); + if (this_present_cardId || that_present_cardId) { + if (!(this_present_cardId && that_present_cardId)) return false; + if (!this.cardId.equals(that.cardId)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(Account other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + Account typedOther = (Account) other; + + lastComparison = Boolean.valueOf(isSetZone()).compareTo(typedOther.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, typedOther.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetCardId()).compareTo(typedOther.isSetCardId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCardId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cardId, typedOther.cardId); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("Account("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("cardId:"); + if (this.cardId == null) { + sb.append("null"); + } else { + sb.append(this.cardId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + if (zone == null) { + throw new TProtocolException("Required field 'zone' was not present! Struct: " + toString()); + } + if (cardId == null) { + throw new TProtocolException( + "Required field 'cardId' was not present! Struct: " + toString()); + } + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class AccountStandardSchemeFactory implements SchemeFactory { + public AccountStandardScheme getScheme() { + return new AccountStandardScheme(); + } + } + + private static class AccountStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, Account struct) throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // CARD_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, Account struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.cardId != null) { + oprot.writeFieldBegin(CARD_ID_FIELD_DESC); + oprot.writeString(struct.cardId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class AccountTupleSchemeFactory implements SchemeFactory { + public AccountTupleScheme getScheme() { + return new AccountTupleScheme(); + } + } + + private static class AccountTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Account struct) throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeString(struct.zone); + oprot.writeString(struct.cardId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Account struct) throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_0/ThriftService.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_0/ThriftService.java new file mode 100644 index 000000000000..166cf219664f --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_0/ThriftService.java @@ -0,0 +1,6926 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_9_0; + +import java.util.BitSet; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ThriftService { + + public interface Iface { + + public String sayHello(String zone, String name) throws TException; + + public String withDelay(int delay) throws TException; + + public String withoutArgs() throws TException; + + public String withError() throws TException; + + public String withCollisioin(String input) throws TException; + + public void noReturn(int delay) throws TException; + + public void oneWayHasArgs(int delay) throws TException; + + public void oneWay() throws TException; + + public void oneWayWithError() throws TException; + + public UserAccount data(User user, Account account) throws TException; + } + + public interface AsyncIface { + + public void sayHello( + String zone, + String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException; + + public void withDelay( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException; + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException; + + public void withError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException; + + public void withCollisioin( + String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException; + + public void noReturn( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException; + + public void oneWayHasArgs( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException; + + public void oneWay( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException; + + public void oneWayWithError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException; + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException; + } + + public static class Client extends org.apache.thrift.TServiceClient implements Iface { + public static class Factory implements org.apache.thrift.TServiceClientFactory { + public Factory() {} + + public Client getClient(org.apache.thrift.protocol.TProtocol prot) { + return new Client(prot); + } + + public Client getClient( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + return new Client(iprot, oprot); + } + } + + public Client(org.apache.thrift.protocol.TProtocol prot) { + super(prot, prot); + } + + public Client( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + super(iprot, oprot); + } + + public String sayHello(String zone, String name) throws TException { + send_sayHello(zone, name); + return recv_sayHello(); + } + + public void send_sayHello(String zone, String name) throws TException { + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + sendBase("sayHello", args); + } + + public String recv_sayHello() throws TException { + sayHello_result result = new sayHello_result(); + receiveBase(result, "sayHello"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "sayHello failed: unknown result"); + } + + public String withDelay(int delay) throws TException { + send_withDelay(delay); + return recv_withDelay(); + } + + public void send_withDelay(int delay) throws TException { + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + sendBase("withDelay", args); + } + + public String recv_withDelay() throws TException { + withDelay_result result = new withDelay_result(); + receiveBase(result, "withDelay"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withDelay failed: unknown result"); + } + + public String withoutArgs() throws TException { + send_withoutArgs(); + return recv_withoutArgs(); + } + + public void send_withoutArgs() throws TException { + withoutArgs_args args = new withoutArgs_args(); + sendBase("withoutArgs", args); + } + + public String recv_withoutArgs() throws TException { + withoutArgs_result result = new withoutArgs_result(); + receiveBase(result, "withoutArgs"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withoutArgs failed: unknown result"); + } + + public String withError() throws TException { + send_withError(); + return recv_withError(); + } + + public void send_withError() throws TException { + withError_args args = new withError_args(); + sendBase("withError", args); + } + + public String recv_withError() throws TException { + withError_result result = new withError_result(); + receiveBase(result, "withError"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withError failed: unknown result"); + } + + public String withCollisioin(String input) throws TException { + send_withCollisioin(input); + return recv_withCollisioin(); + } + + public void send_withCollisioin(String input) throws TException { + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + sendBase("withCollisioin", args); + } + + public String recv_withCollisioin() throws TException { + withCollisioin_result result = new withCollisioin_result(); + receiveBase(result, "withCollisioin"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withCollisioin failed: unknown result"); + } + + public void noReturn(int delay) throws TException { + send_noReturn(delay); + recv_noReturn(); + } + + public void send_noReturn(int delay) throws TException { + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + sendBase("noReturn", args); + } + + public void recv_noReturn() throws TException { + noReturn_result result = new noReturn_result(); + receiveBase(result, "noReturn"); + return; + } + + public void oneWayHasArgs(int delay) throws TException { + send_oneWayHasArgs(delay); + } + + public void send_oneWayHasArgs(int delay) throws TException { + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + sendBase("oneWayHasArgs", args); + } + + public void oneWay() throws TException { + send_oneWay(); + } + + public void send_oneWay() throws TException { + oneWay_args args = new oneWay_args(); + sendBase("oneWay", args); + } + + public void oneWayWithError() throws TException { + send_oneWayWithError(); + } + + public void send_oneWayWithError() throws TException { + oneWayWithError_args args = new oneWayWithError_args(); + sendBase("oneWayWithError", args); + } + + public UserAccount data(User user, Account account) throws TException { + send_data(user, account); + return recv_data(); + } + + public void send_data(User user, Account account) throws TException { + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + sendBase("data", args); + } + + public UserAccount recv_data() throws TException { + data_result result = new data_result(); + receiveBase(result, "data"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, "data failed: unknown result"); + } + } + + public static class AsyncClient extends org.apache.thrift.async.TAsyncClient + implements AsyncIface { + public static class Factory + implements org.apache.thrift.async.TAsyncClientFactory { + private org.apache.thrift.async.TAsyncClientManager clientManager; + private org.apache.thrift.protocol.TProtocolFactory protocolFactory; + + public Factory( + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.protocol.TProtocolFactory protocolFactory) { + this.clientManager = clientManager; + this.protocolFactory = protocolFactory; + } + + public AsyncClient getAsyncClient( + org.apache.thrift.transport.TNonblockingTransport transport) { + return new AsyncClient(protocolFactory, clientManager, transport); + } + } + + public AsyncClient( + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.transport.TNonblockingTransport transport) { + super(protocolFactory, clientManager, transport); + } + + public void sayHello( + String zone, + String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + checkReady(); + sayHello_call method_call = + new sayHello_call(zone, name, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class sayHello_call extends org.apache.thrift.async.TAsyncMethodCall { + private String zone; + private String name; + + public sayHello_call( + String zone, + String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + this.zone = zone; + this.name = name; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "sayHello", org.apache.thrift.protocol.TMessageType.CALL, 0)); + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_sayHello(); + } + } + + public void withDelay( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + checkReady(); + withDelay_call method_call = + new withDelay_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withDelay_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public withDelay_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withDelay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withDelay(); + } + } + + public void withoutArgs( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + checkReady(); + withoutArgs_call method_call = + new withoutArgs_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withoutArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + public withoutArgs_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withoutArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withoutArgs_args args = new withoutArgs_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withoutArgs(); + } + } + + public void withError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + checkReady(); + withError_call method_call = + new withError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withError_call extends org.apache.thrift.async.TAsyncMethodCall { + public withError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withError_args args = new withError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withError(); + } + } + + public void withCollisioin( + String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + checkReady(); + withCollisioin_call method_call = + new withCollisioin_call(input, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withCollisioin_call extends org.apache.thrift.async.TAsyncMethodCall { + private String input; + + public withCollisioin_call( + String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + this.input = input; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withCollisioin", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withCollisioin(); + } + } + + public void noReturn( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + checkReady(); + noReturn_call method_call = + new noReturn_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class noReturn_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public noReturn_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "noReturn", org.apache.thrift.protocol.TMessageType.CALL, 0)); + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + (new Client(prot)).recv_noReturn(); + } + } + + public void oneWayHasArgs( + int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + checkReady(); + oneWayHasArgs_call method_call = + new oneWayHasArgs_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayHasArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public oneWayHasArgs_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, true); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayHasArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + checkReady(); + oneWay_call method_call = + new oneWay_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWay_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWay_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + oneWay_args args = new oneWay_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void oneWayWithError( + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + checkReady(); + oneWayWithError_call method_call = + new oneWayWithError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayWithError_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWayWithError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayWithError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + oneWayWithError_args args = new oneWayWithError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void data( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + checkReady(); + data_call method_call = + new data_call(user, account, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class data_call extends org.apache.thrift.async.TAsyncMethodCall { + private User user; + private Account account; + + public data_call( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws TException { + super(client, protocolFactory, transport, resultHandler, false); + this.user = user; + this.account = account; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "data", org.apache.thrift.protocol.TMessageType.CALL, 0)); + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + args.write(prot); + prot.writeMessageEnd(); + } + + public UserAccount getResult() throws TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_data(); + } + } + } + + public static class Processor extends org.apache.thrift.TBaseProcessor + implements org.apache.thrift.TProcessor { + private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); + + public Processor(I iface) { + super( + iface, + getProcessMap( + new HashMap< + String, + org.apache.thrift.ProcessFunction>())); + } + + protected Processor( + I iface, + Map> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + Map> + getProcessMap( + Map> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.ProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + protected boolean isOneway() { + return false; + } + + public sayHello_result getResult(I iface, sayHello_args args) throws TException { + sayHello_result result = new sayHello_result(); + result.success = iface.sayHello(args.zone, args.name); + return result; + } + } + + public static class withDelay + extends org.apache.thrift.ProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + protected boolean isOneway() { + return false; + } + + public withDelay_result getResult(I iface, withDelay_args args) throws TException { + withDelay_result result = new withDelay_result(); + result.success = iface.withDelay(args.delay); + return result; + } + } + + public static class withoutArgs + extends org.apache.thrift.ProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + protected boolean isOneway() { + return false; + } + + public withoutArgs_result getResult(I iface, withoutArgs_args args) throws TException { + withoutArgs_result result = new withoutArgs_result(); + result.success = iface.withoutArgs(); + return result; + } + } + + public static class withError + extends org.apache.thrift.ProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + protected boolean isOneway() { + return false; + } + + public withError_result getResult(I iface, withError_args args) throws TException { + withError_result result = new withError_result(); + result.success = iface.withError(); + return result; + } + } + + public static class withCollisioin + extends org.apache.thrift.ProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + protected boolean isOneway() { + return false; + } + + public withCollisioin_result getResult(I iface, withCollisioin_args args) throws TException { + withCollisioin_result result = new withCollisioin_result(); + result.success = iface.withCollisioin(args.input); + return result; + } + } + + public static class noReturn + extends org.apache.thrift.ProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + protected boolean isOneway() { + return false; + } + + public noReturn_result getResult(I iface, noReturn_args args) throws TException { + noReturn_result result = new noReturn_result(); + iface.noReturn(args.delay); + return result; + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.ProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + protected boolean isOneway() { + return true; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayHasArgs_args args) throws TException { + iface.oneWayHasArgs(args.delay); + return null; + } + } + + public static class oneWay + extends org.apache.thrift.ProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + protected boolean isOneway() { + return true; + } + + public org.apache.thrift.TBase getResult(I iface, oneWay_args args) throws TException { + iface.oneWay(); + return null; + } + } + + public static class oneWayWithError + extends org.apache.thrift.ProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + protected boolean isOneway() { + return true; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayWithError_args args) + throws TException { + iface.oneWayWithError(); + return null; + } + } + + public static class data + extends org.apache.thrift.ProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + protected boolean isOneway() { + return false; + } + + public data_result getResult(I iface, data_args args) throws TException { + data_result result = new data_result(); + result.success = iface.data(args.user, args.account); + return result; + } + } + } + + public static class sayHello_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_args"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new sayHello_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new sayHello_argsTupleSchemeFactory()); + } + + public String zone; // required + public String name; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + NAME((short) 2, "name"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // NAME + return NAME; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_args.class, metaDataMap); + } + + public sayHello_args() {} + + public sayHello_args(String zone, String name) { + this(); + this.zone = zone; + this.name = name; + } + + /** Performs a deep copy on other. */ + public sayHello_args(sayHello_args other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetName()) { + this.name = other.name; + } + } + + public sayHello_args deepCopy() { + return new sayHello_args(this); + } + + @Override + public void clear() { + this.zone = null; + this.name = null; + } + + public String getZone() { + return this.zone; + } + + public sayHello_args setZone(String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + public String getName() { + return this.name; + } + + public sayHello_args setName(String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((String) value); + } + break; + + case NAME: + if (value == null) { + unsetName(); + } else { + setName((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case NAME: + return getName(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case NAME: + return isSetName(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof sayHello_args) return this.equals((sayHello_args) that); + return false; + } + + public boolean equals(sayHello_args that) { + if (that == null) return false; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(sayHello_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + sayHello_args typedOther = (sayHello_args) other; + + lastComparison = Boolean.valueOf(isSetZone()).compareTo(typedOther.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, typedOther.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetName()).compareTo(typedOther.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, typedOther.name); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("sayHello_args("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_argsStandardSchemeFactory implements SchemeFactory { + public sayHello_argsStandardScheme getScheme() { + return new sayHello_argsStandardScheme(); + } + } + + private static class sayHello_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_argsTupleSchemeFactory implements SchemeFactory { + public sayHello_argsTupleScheme getScheme() { + return new sayHello_argsTupleScheme(); + } + } + + private static class sayHello_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetZone()) { + optionals.set(0); + } + if (struct.isSetName()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetZone()) { + oprot.writeString(struct.zone); + } + if (struct.isSetName()) { + oprot.writeString(struct.name); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } + if (incoming.get(1)) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } + } + } + } + + public static class sayHello_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new sayHello_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new sayHello_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_result.class, metaDataMap); + } + + public sayHello_result() {} + + public sayHello_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public sayHello_result(sayHello_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public sayHello_result deepCopy() { + return new sayHello_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public sayHello_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof sayHello_result) return this.equals((sayHello_result) that); + return false; + } + + public boolean equals(sayHello_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(sayHello_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + sayHello_result typedOther = (sayHello_result) other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("sayHello_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_resultStandardSchemeFactory implements SchemeFactory { + public sayHello_resultStandardScheme getScheme() { + return new sayHello_resultStandardScheme(); + } + } + + private static class sayHello_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_resultTupleSchemeFactory implements SchemeFactory { + public sayHello_resultTupleScheme getScheme() { + return new sayHello_resultTupleScheme(); + } + } + + private static class sayHello_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withDelay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withDelay_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withDelay_argsTupleSchemeFactory()); + } + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_args.class, metaDataMap); + } + + public withDelay_args() {} + + public withDelay_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public withDelay_args(withDelay_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public withDelay_args deepCopy() { + return new withDelay_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public withDelay_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return Integer.valueOf(getDelay()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withDelay_args) return this.equals((withDelay_args) that); + return false; + } + + public boolean equals(withDelay_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withDelay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withDelay_args typedOther = (withDelay_args) other; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(typedOther.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, typedOther.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withDelay_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_argsStandardSchemeFactory implements SchemeFactory { + public withDelay_argsStandardScheme getScheme() { + return new withDelay_argsStandardScheme(); + } + } + + private static class withDelay_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_argsTupleSchemeFactory implements SchemeFactory { + public withDelay_argsTupleScheme getScheme() { + return new withDelay_argsTupleScheme(); + } + } + + private static class withDelay_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + } + + public static class withDelay_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withDelay_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withDelay_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_result.class, metaDataMap); + } + + public withDelay_result() {} + + public withDelay_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withDelay_result(withDelay_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withDelay_result deepCopy() { + return new withDelay_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withDelay_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withDelay_result) return this.equals((withDelay_result) that); + return false; + } + + public boolean equals(withDelay_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withDelay_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withDelay_result typedOther = (withDelay_result) other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withDelay_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_resultStandardSchemeFactory implements SchemeFactory { + public withDelay_resultStandardScheme getScheme() { + return new withDelay_resultStandardScheme(); + } + } + + private static class withDelay_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_resultTupleSchemeFactory implements SchemeFactory { + public withDelay_resultTupleScheme getScheme() { + return new withDelay_resultTupleScheme(); + } + } + + private static class withDelay_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withoutArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withoutArgs_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withoutArgs_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_args.class, metaDataMap); + } + + public withoutArgs_args() {} + + /** Performs a deep copy on other. */ + public withoutArgs_args(withoutArgs_args other) {} + + public withoutArgs_args deepCopy() { + return new withoutArgs_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withoutArgs_args) return this.equals((withoutArgs_args) that); + return false; + } + + public boolean equals(withoutArgs_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withoutArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withoutArgs_args typedOther = (withoutArgs_args) other; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withoutArgs_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_argsStandardSchemeFactory implements SchemeFactory { + public withoutArgs_argsStandardScheme getScheme() { + return new withoutArgs_argsStandardScheme(); + } + } + + private static class withoutArgs_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_argsTupleSchemeFactory implements SchemeFactory { + public withoutArgs_argsTupleScheme getScheme() { + return new withoutArgs_argsTupleScheme(); + } + } + + private static class withoutArgs_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class withoutArgs_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withoutArgs_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withoutArgs_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_result.class, metaDataMap); + } + + public withoutArgs_result() {} + + public withoutArgs_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withoutArgs_result(withoutArgs_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withoutArgs_result deepCopy() { + return new withoutArgs_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withoutArgs_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withoutArgs_result) return this.equals((withoutArgs_result) that); + return false; + } + + public boolean equals(withoutArgs_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withoutArgs_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withoutArgs_result typedOther = (withoutArgs_result) other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withoutArgs_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_resultStandardSchemeFactory implements SchemeFactory { + public withoutArgs_resultStandardScheme getScheme() { + return new withoutArgs_resultStandardScheme(); + } + } + + private static class withoutArgs_resultStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_resultTupleSchemeFactory implements SchemeFactory { + public withoutArgs_resultTupleScheme getScheme() { + return new withoutArgs_resultTupleScheme(); + } + } + + private static class withoutArgs_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withError_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withError_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_args.class, metaDataMap); + } + + public withError_args() {} + + /** Performs a deep copy on other. */ + public withError_args(withError_args other) {} + + public withError_args deepCopy() { + return new withError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withError_args) return this.equals((withError_args) that); + return false; + } + + public boolean equals(withError_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withError_args typedOther = (withError_args) other; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_argsStandardSchemeFactory implements SchemeFactory { + public withError_argsStandardScheme getScheme() { + return new withError_argsStandardScheme(); + } + } + + private static class withError_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_argsTupleSchemeFactory implements SchemeFactory { + public withError_argsTupleScheme getScheme() { + return new withError_argsTupleScheme(); + } + } + + private static class withError_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class withError_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withError_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withError_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_result.class, metaDataMap); + } + + public withError_result() {} + + public withError_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withError_result(withError_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withError_result deepCopy() { + return new withError_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withError_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withError_result) return this.equals((withError_result) that); + return false; + } + + public boolean equals(withError_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withError_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withError_result typedOther = (withError_result) other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withError_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_resultStandardSchemeFactory implements SchemeFactory { + public withError_resultStandardScheme getScheme() { + return new withError_resultStandardScheme(); + } + } + + private static class withError_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_resultTupleSchemeFactory implements SchemeFactory { + public withError_resultTupleScheme getScheme() { + return new withError_resultTupleScheme(); + } + } + + private static class withError_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withCollisioin_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_args"); + + private static final org.apache.thrift.protocol.TField INPUT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "input", org.apache.thrift.protocol.TType.STRING, (short) 3333); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withCollisioin_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withCollisioin_argsTupleSchemeFactory()); + } + + public String input; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + INPUT((short) 3333, "input"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 3333: // INPUT + return INPUT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.INPUT, + new org.apache.thrift.meta_data.FieldMetaData( + "input", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_args.class, metaDataMap); + } + + public withCollisioin_args() {} + + public withCollisioin_args(String input) { + this(); + this.input = input; + } + + /** Performs a deep copy on other. */ + public withCollisioin_args(withCollisioin_args other) { + if (other.isSetInput()) { + this.input = other.input; + } + } + + public withCollisioin_args deepCopy() { + return new withCollisioin_args(this); + } + + @Override + public void clear() { + this.input = null; + } + + public String getInput() { + return this.input; + } + + public withCollisioin_args setInput(String input) { + this.input = input; + return this; + } + + public void unsetInput() { + this.input = null; + } + + /** Returns true if field input is set (has been assigned a value) and false otherwise */ + public boolean isSetInput() { + return this.input != null; + } + + public void setInputIsSet(boolean value) { + if (!value) { + this.input = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case INPUT: + if (value == null) { + unsetInput(); + } else { + setInput((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case INPUT: + return getInput(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case INPUT: + return isSetInput(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withCollisioin_args) return this.equals((withCollisioin_args) that); + return false; + } + + public boolean equals(withCollisioin_args that) { + if (that == null) return false; + + boolean this_present_input = true && this.isSetInput(); + boolean that_present_input = true && that.isSetInput(); + if (this_present_input || that_present_input) { + if (!(this_present_input && that_present_input)) return false; + if (!this.input.equals(that.input)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withCollisioin_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withCollisioin_args typedOther = (withCollisioin_args) other; + + lastComparison = Boolean.valueOf(isSetInput()).compareTo(typedOther.isSetInput()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInput()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.input, typedOther.input); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withCollisioin_args("); + boolean first = true; + + sb.append("input:"); + if (this.input == null) { + sb.append("null"); + } else { + sb.append(this.input); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_argsStandardSchemeFactory implements SchemeFactory { + public withCollisioin_argsStandardScheme getScheme() { + return new withCollisioin_argsStandardScheme(); + } + } + + private static class withCollisioin_argsStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 3333: // INPUT + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.input != null) { + oprot.writeFieldBegin(INPUT_FIELD_DESC); + oprot.writeString(struct.input); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_argsTupleSchemeFactory implements SchemeFactory { + public withCollisioin_argsTupleScheme getScheme() { + return new withCollisioin_argsTupleScheme(); + } + } + + private static class withCollisioin_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetInput()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetInput()) { + oprot.writeString(struct.input); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } + } + } + } + + public static class withCollisioin_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withCollisioin_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withCollisioin_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_result.class, metaDataMap); + } + + public withCollisioin_result() {} + + public withCollisioin_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withCollisioin_result(withCollisioin_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withCollisioin_result deepCopy() { + return new withCollisioin_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withCollisioin_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withCollisioin_result) return this.equals((withCollisioin_result) that); + return false; + } + + public boolean equals(withCollisioin_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(withCollisioin_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + withCollisioin_result typedOther = (withCollisioin_result) other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withCollisioin_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_resultStandardSchemeFactory implements SchemeFactory { + public withCollisioin_resultStandardScheme getScheme() { + return new withCollisioin_resultStandardScheme(); + } + } + + private static class withCollisioin_resultStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_resultTupleSchemeFactory implements SchemeFactory { + public withCollisioin_resultTupleScheme getScheme() { + return new withCollisioin_resultTupleScheme(); + } + } + + private static class withCollisioin_resultTupleScheme + extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class noReturn_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new noReturn_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new noReturn_argsTupleSchemeFactory()); + } + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_args.class, metaDataMap); + } + + public noReturn_args() {} + + public noReturn_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public noReturn_args(noReturn_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public noReturn_args deepCopy() { + return new noReturn_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public noReturn_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return Integer.valueOf(getDelay()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof noReturn_args) return this.equals((noReturn_args) that); + return false; + } + + public boolean equals(noReturn_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(noReturn_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + noReturn_args typedOther = (noReturn_args) other; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(typedOther.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, typedOther.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("noReturn_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_argsStandardSchemeFactory implements SchemeFactory { + public noReturn_argsStandardScheme getScheme() { + return new noReturn_argsStandardScheme(); + } + } + + private static class noReturn_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_argsTupleSchemeFactory implements SchemeFactory { + public noReturn_argsTupleScheme getScheme() { + return new noReturn_argsTupleScheme(); + } + } + + private static class noReturn_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + } + + public static class noReturn_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_result"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new noReturn_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new noReturn_resultTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_result.class, metaDataMap); + } + + public noReturn_result() {} + + /** Performs a deep copy on other. */ + public noReturn_result(noReturn_result other) {} + + public noReturn_result deepCopy() { + return new noReturn_result(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof noReturn_result) return this.equals((noReturn_result) that); + return false; + } + + public boolean equals(noReturn_result that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(noReturn_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + noReturn_result typedOther = (noReturn_result) other; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("noReturn_result("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_resultStandardSchemeFactory implements SchemeFactory { + public noReturn_resultStandardScheme getScheme() { + return new noReturn_resultStandardScheme(); + } + } + + private static class noReturn_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_resultTupleSchemeFactory implements SchemeFactory { + public noReturn_resultTupleScheme getScheme() { + return new noReturn_resultTupleScheme(); + } + } + + private static class noReturn_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class oneWayHasArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayHasArgs_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new oneWayHasArgs_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new oneWayHasArgs_argsTupleSchemeFactory()); + } + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayHasArgs_args.class, metaDataMap); + } + + public oneWayHasArgs_args() {} + + public oneWayHasArgs_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public oneWayHasArgs_args(oneWayHasArgs_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public oneWayHasArgs_args deepCopy() { + return new oneWayHasArgs_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public oneWayHasArgs_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return Integer.valueOf(getDelay()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWayHasArgs_args) return this.equals((oneWayHasArgs_args) that); + return false; + } + + public boolean equals(oneWayHasArgs_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(oneWayHasArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + oneWayHasArgs_args typedOther = (oneWayHasArgs_args) other; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(typedOther.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, typedOther.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWayHasArgs_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayHasArgs_argsStandardSchemeFactory implements SchemeFactory { + public oneWayHasArgs_argsStandardScheme getScheme() { + return new oneWayHasArgs_argsStandardScheme(); + } + } + + private static class oneWayHasArgs_argsStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayHasArgs_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayHasArgs_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayHasArgs_argsTupleSchemeFactory implements SchemeFactory { + public oneWayHasArgs_argsTupleScheme getScheme() { + return new oneWayHasArgs_argsTupleScheme(); + } + } + + private static class oneWayHasArgs_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + } + + public static class oneWay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWay_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new oneWay_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new oneWay_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWay_args.class, metaDataMap); + } + + public oneWay_args() {} + + /** Performs a deep copy on other. */ + public oneWay_args(oneWay_args other) {} + + public oneWay_args deepCopy() { + return new oneWay_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWay_args) return this.equals((oneWay_args) that); + return false; + } + + public boolean equals(oneWay_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(oneWay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + oneWay_args typedOther = (oneWay_args) other; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWay_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWay_argsStandardSchemeFactory implements SchemeFactory { + public oneWay_argsStandardScheme getScheme() { + return new oneWay_argsStandardScheme(); + } + } + + private static class oneWay_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWay_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWay_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWay_argsTupleSchemeFactory implements SchemeFactory { + public oneWay_argsTupleScheme getScheme() { + return new oneWay_argsTupleScheme(); + } + } + + private static class oneWay_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class oneWayWithError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayWithError_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new oneWayWithError_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new oneWayWithError_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayWithError_args.class, metaDataMap); + } + + public oneWayWithError_args() {} + + /** Performs a deep copy on other. */ + public oneWayWithError_args(oneWayWithError_args other) {} + + public oneWayWithError_args deepCopy() { + return new oneWayWithError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWayWithError_args) return this.equals((oneWayWithError_args) that); + return false; + } + + public boolean equals(oneWayWithError_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(oneWayWithError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + oneWayWithError_args typedOther = (oneWayWithError_args) other; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWayWithError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayWithError_argsStandardSchemeFactory implements SchemeFactory { + public oneWayWithError_argsStandardScheme getScheme() { + return new oneWayWithError_argsStandardScheme(); + } + } + + private static class oneWayWithError_argsStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayWithError_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayWithError_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayWithError_argsTupleSchemeFactory implements SchemeFactory { + public oneWayWithError_argsTupleScheme getScheme() { + return new oneWayWithError_argsTupleScheme(); + } + } + + private static class oneWayWithError_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class data_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_args"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new data_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new data_argsTupleSchemeFactory()); + } + + public User user; // required + public Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(data_args.class, metaDataMap); + } + + public data_args() {} + + public data_args(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public data_args(data_args other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public data_args deepCopy() { + return new data_args(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + public User getUser() { + return this.user; + } + + public data_args setUser(User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + public Account getAccount() { + return this.account; + } + + public data_args setAccount(Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof data_args) return this.equals((data_args) that); + return false; + } + + public boolean equals(data_args that) { + if (that == null) return false; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(data_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + data_args typedOther = (data_args) other; + + lastComparison = Boolean.valueOf(isSetUser()).compareTo(typedOther.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, typedOther.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAccount()).compareTo(typedOther.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, typedOther.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("data_args("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_argsStandardSchemeFactory implements SchemeFactory { + public data_argsStandardScheme getScheme() { + return new data_argsStandardScheme(); + } + } + + private static class data_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_args struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_args struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_argsTupleSchemeFactory implements SchemeFactory { + public data_argsTupleScheme getScheme() { + return new data_argsTupleScheme(); + } + } + + private static class data_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetUser()) { + optionals.set(0); + } + if (struct.isSetAccount()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetUser()) { + struct.user.write(oprot); + } + if (struct.isSetAccount()) { + struct.account.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } + if (incoming.get(1)) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + } + } + + public static class data_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRUCT, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new data_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new data_resultTupleSchemeFactory()); + } + + public UserAccount success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, UserAccount.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + data_result.class, metaDataMap); + } + + public data_result() {} + + public data_result(UserAccount success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public data_result(data_result other) { + if (other.isSetSuccess()) { + this.success = new UserAccount(other.success); + } + } + + public data_result deepCopy() { + return new data_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public UserAccount getSuccess() { + return this.success; + } + + public data_result setSuccess(UserAccount success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((UserAccount) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof data_result) return this.equals((data_result) that); + return false; + } + + public boolean equals(data_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(data_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + data_result typedOther = (data_result) other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("data_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_resultStandardSchemeFactory implements SchemeFactory { + public data_resultStandardScheme getScheme() { + return new data_resultStandardScheme(); + } + } + + private static class data_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_result struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_result struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_resultTupleSchemeFactory implements SchemeFactory { + public data_resultTupleScheme getScheme() { + return new data_resultTupleScheme(); + } + } + + private static class data_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_0/User.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_0/User.java new file mode 100644 index 000000000000..3f93246e180d --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_0/User.java @@ -0,0 +1,571 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_9_0; + +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; + +public class User + implements org.apache.thrift.TBase, java.io.Serializable, Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("User"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "userId", org.apache.thrift.protocol.TType.STRING, (short) 2); + private static final org.apache.thrift.protocol.TField AGE_FIELD_DESC = + new org.apache.thrift.protocol.TField("age", org.apache.thrift.protocol.TType.I32, (short) 3); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new UserStandardSchemeFactory()); + schemes.put(TupleScheme.class, new UserTupleSchemeFactory()); + } + + public String name; // required + public String userId; // required + public int age; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + NAME((short) 1, "name"), + USER_ID((short) 2, "userId"), + AGE((short) 3, "age"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // NAME + return NAME; + case 2: // USER_ID + return USER_ID; + case 3: // AGE + return AGE; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __AGE_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.USER_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "userId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.AGE, + new org.apache.thrift.meta_data.FieldMetaData( + "age", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(User.class, metaDataMap); + } + + public User() {} + + public User(String name, String userId, int age) { + this(); + this.name = name; + this.userId = userId; + this.age = age; + setAgeIsSet(true); + } + + /** Performs a deep copy on other. */ + public User(User other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetName()) { + this.name = other.name; + } + if (other.isSetUserId()) { + this.userId = other.userId; + } + this.age = other.age; + } + + public User deepCopy() { + return new User(this); + } + + @Override + public void clear() { + this.name = null; + this.userId = null; + setAgeIsSet(false); + this.age = 0; + } + + public String getName() { + return this.name; + } + + public User setName(String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public String getUserId() { + return this.userId; + } + + public User setUserId(String userId) { + this.userId = userId; + return this; + } + + public void unsetUserId() { + this.userId = null; + } + + /** Returns true if field userId is set (has been assigned a value) and false otherwise */ + public boolean isSetUserId() { + return this.userId != null; + } + + public void setUserIdIsSet(boolean value) { + if (!value) { + this.userId = null; + } + } + + public int getAge() { + return this.age; + } + + public User setAge(int age) { + this.age = age; + setAgeIsSet(true); + return this; + } + + public void unsetAge() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __AGE_ISSET_ID); + } + + /** Returns true if field age is set (has been assigned a value) and false otherwise */ + public boolean isSetAge() { + return EncodingUtils.testBit(__isset_bitfield, __AGE_ISSET_ID); + } + + public void setAgeIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __AGE_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case NAME: + if (value == null) { + unsetName(); + } else { + setName((String) value); + } + break; + + case USER_ID: + if (value == null) { + unsetUserId(); + } else { + setUserId((String) value); + } + break; + + case AGE: + if (value == null) { + unsetAge(); + } else { + setAge((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case NAME: + return getName(); + + case USER_ID: + return getUserId(); + + case AGE: + return Integer.valueOf(getAge()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case NAME: + return isSetName(); + case USER_ID: + return isSetUserId(); + case AGE: + return isSetAge(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof User) return this.equals((User) that); + return false; + } + + public boolean equals(User that) { + if (that == null) return false; + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + boolean this_present_userId = true && this.isSetUserId(); + boolean that_present_userId = true && that.isSetUserId(); + if (this_present_userId || that_present_userId) { + if (!(this_present_userId && that_present_userId)) return false; + if (!this.userId.equals(that.userId)) return false; + } + + boolean this_present_age = true; + boolean that_present_age = true; + if (this_present_age || that_present_age) { + if (!(this_present_age && that_present_age)) return false; + if (this.age != that.age) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(User other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + User typedOther = (User) other; + + lastComparison = Boolean.valueOf(isSetName()).compareTo(typedOther.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, typedOther.name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetUserId()).compareTo(typedOther.isSetUserId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, typedOther.userId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAge()).compareTo(typedOther.isSetAge()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAge()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.age, typedOther.age); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("User("); + boolean first = true; + + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + if (!first) sb.append(", "); + sb.append("userId:"); + if (this.userId == null) { + sb.append("null"); + } else { + sb.append(this.userId); + } + first = false; + if (!first) sb.append(", "); + sb.append("age:"); + sb.append(this.age); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + if (name == null) { + throw new TProtocolException("Required field 'name' was not present! Struct: " + toString()); + } + if (userId == null) { + throw new TProtocolException( + "Required field 'userId' was not present! Struct: " + toString()); + } + // alas, we cannot check 'age' because it's a primitive and you chose the non-beans generator. + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserStandardSchemeFactory implements SchemeFactory { + public UserStandardScheme getScheme() { + return new UserStandardScheme(); + } + } + + private static class UserStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, User struct) throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // AGE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + if (!struct.isSetAge()) { + throw new TProtocolException( + "Required field 'age' was not found in serialized data! Struct: " + toString()); + } + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, User struct) throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + if (struct.userId != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userId); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(AGE_FIELD_DESC); + oprot.writeI32(struct.age); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserTupleSchemeFactory implements SchemeFactory { + public UserTupleScheme getScheme() { + return new UserTupleScheme(); + } + } + + private static class UserTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, User struct) throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeString(struct.name); + oprot.writeString(struct.userId); + oprot.writeI32(struct.age); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, User struct) throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.name = iprot.readString(); + struct.setNameIsSet(true); + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_0/UserAccount.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_0/UserAccount.java new file mode 100644 index 000000000000..432021338061 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_0/UserAccount.java @@ -0,0 +1,486 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_9_0; + +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; +import org.apache.thrift.TException; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; + +public class UserAccount + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("UserAccount"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new UserAccountStandardSchemeFactory()); + schemes.put(TupleScheme.class, new UserAccountTupleSchemeFactory()); + } + + public User user; // required + public Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserAccount.class, metaDataMap); + } + + public UserAccount() {} + + public UserAccount(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public UserAccount(UserAccount other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public UserAccount deepCopy() { + return new UserAccount(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + public User getUser() { + return this.user; + } + + public UserAccount setUser(User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + public Account getAccount() { + return this.account; + } + + public UserAccount setAccount(Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof UserAccount) return this.equals((UserAccount) that); + return false; + } + + public boolean equals(UserAccount that) { + if (that == null) return false; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(UserAccount other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + UserAccount typedOther = (UserAccount) other; + + lastComparison = Boolean.valueOf(isSetUser()).compareTo(typedOther.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, typedOther.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAccount()).compareTo(typedOther.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, typedOther.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("UserAccount("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + if (user == null) { + throw new TProtocolException("Required field 'user' was not present! Struct: " + toString()); + } + if (account == null) { + throw new TProtocolException( + "Required field 'account' was not present! Struct: " + toString()); + } + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserAccountStandardSchemeFactory implements SchemeFactory { + public UserAccountStandardScheme getScheme() { + return new UserAccountStandardScheme(); + } + } + + private static class UserAccountStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, UserAccount struct) + throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, UserAccount struct) + throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserAccountTupleSchemeFactory implements SchemeFactory { + public UserAccountTupleScheme getScheme() { + return new UserAccountTupleScheme(); + } + } + + private static class UserAccountTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + struct.user.write(oprot); + struct.account.write(oprot); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_1/Account.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_1/Account.java new file mode 100644 index 000000000000..72dab59130d4 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_1/Account.java @@ -0,0 +1,478 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_9_1; + +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.server.AbstractNonblockingServer.*; + +public class Account + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("Account"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField CARD_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "cardId", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new AccountStandardSchemeFactory()); + schemes.put(TupleScheme.class, new AccountTupleSchemeFactory()); + } + + public String zone; // required + public String cardId; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + CARD_ID((short) 2, "cardId"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // CARD_ID + return CARD_ID; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.CARD_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "cardId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Account.class, metaDataMap); + } + + public Account() {} + + public Account(String zone, String cardId) { + this(); + this.zone = zone; + this.cardId = cardId; + } + + /** Performs a deep copy on other. */ + public Account(Account other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetCardId()) { + this.cardId = other.cardId; + } + } + + public Account deepCopy() { + return new Account(this); + } + + @Override + public void clear() { + this.zone = null; + this.cardId = null; + } + + public String getZone() { + return this.zone; + } + + public Account setZone(String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + public String getCardId() { + return this.cardId; + } + + public Account setCardId(String cardId) { + this.cardId = cardId; + return this; + } + + public void unsetCardId() { + this.cardId = null; + } + + /** Returns true if field cardId is set (has been assigned a value) and false otherwise */ + public boolean isSetCardId() { + return this.cardId != null; + } + + public void setCardIdIsSet(boolean value) { + if (!value) { + this.cardId = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((String) value); + } + break; + + case CARD_ID: + if (value == null) { + unsetCardId(); + } else { + setCardId((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case CARD_ID: + return getCardId(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case CARD_ID: + return isSetCardId(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof Account) return this.equals((Account) that); + return false; + } + + public boolean equals(Account that) { + if (that == null) return false; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_cardId = true && this.isSetCardId(); + boolean that_present_cardId = true && that.isSetCardId(); + if (this_present_cardId || that_present_cardId) { + if (!(this_present_cardId && that_present_cardId)) return false; + if (!this.cardId.equals(that.cardId)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(Account other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetZone()).compareTo(other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetCardId()).compareTo(other.isSetCardId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCardId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cardId, other.cardId); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("Account("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("cardId:"); + if (this.cardId == null) { + sb.append("null"); + } else { + sb.append(this.cardId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (zone == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'zone' was not present! Struct: " + toString()); + } + if (cardId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'cardId' was not present! Struct: " + toString()); + } + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class AccountStandardSchemeFactory implements SchemeFactory { + public AccountStandardScheme getScheme() { + return new AccountStandardScheme(); + } + } + + private static class AccountStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // CARD_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, Account struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.cardId != null) { + oprot.writeFieldBegin(CARD_ID_FIELD_DESC); + oprot.writeString(struct.cardId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class AccountTupleSchemeFactory implements SchemeFactory { + public AccountTupleScheme getScheme() { + return new AccountTupleScheme(); + } + } + + private static class AccountTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeString(struct.zone); + oprot.writeString(struct.cardId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_1/ThriftService.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_1/ThriftService.java new file mode 100644 index 000000000000..835e86ad4dbb --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_1/ThriftService.java @@ -0,0 +1,7540 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_9_1; + +import java.util.BitSet; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.server.AbstractNonblockingServer.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ThriftService { + + public interface Iface { + + public String sayHello(String zone, String name) throws org.apache.thrift.TException; + + public String withDelay(int delay) throws org.apache.thrift.TException; + + public String withoutArgs() throws org.apache.thrift.TException; + + public String withError() throws org.apache.thrift.TException; + + public String withCollisioin(String input) throws org.apache.thrift.TException; + + public void noReturn(int delay) throws org.apache.thrift.TException; + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException; + + public void oneWay() throws org.apache.thrift.TException; + + public void oneWayWithError() throws org.apache.thrift.TException; + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException; + } + + public interface AsyncIface { + + public void sayHello( + String zone, String name, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withDelay(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withoutArgs(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withCollisioin( + String input, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayHasArgs(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void data( + User user, Account account, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + } + + public static class Client extends org.apache.thrift.TServiceClient implements Iface { + public static class Factory implements org.apache.thrift.TServiceClientFactory { + public Factory() {} + + public Client getClient(org.apache.thrift.protocol.TProtocol prot) { + return new Client(prot); + } + + public Client getClient( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + return new Client(iprot, oprot); + } + } + + public Client(org.apache.thrift.protocol.TProtocol prot) { + super(prot, prot); + } + + public Client( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + super(iprot, oprot); + } + + public String sayHello(String zone, String name) throws org.apache.thrift.TException { + send_sayHello(zone, name); + return recv_sayHello(); + } + + public void send_sayHello(String zone, String name) throws org.apache.thrift.TException { + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + sendBase("sayHello", args); + } + + public String recv_sayHello() throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + receiveBase(result, "sayHello"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "sayHello failed: unknown result"); + } + + public String withDelay(int delay) throws org.apache.thrift.TException { + send_withDelay(delay); + return recv_withDelay(); + } + + public void send_withDelay(int delay) throws org.apache.thrift.TException { + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + sendBase("withDelay", args); + } + + public String recv_withDelay() throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + receiveBase(result, "withDelay"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withDelay failed: unknown result"); + } + + public String withoutArgs() throws org.apache.thrift.TException { + send_withoutArgs(); + return recv_withoutArgs(); + } + + public void send_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_args args = new withoutArgs_args(); + sendBase("withoutArgs", args); + } + + public String recv_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + receiveBase(result, "withoutArgs"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withoutArgs failed: unknown result"); + } + + public String withError() throws org.apache.thrift.TException { + send_withError(); + return recv_withError(); + } + + public void send_withError() throws org.apache.thrift.TException { + withError_args args = new withError_args(); + sendBase("withError", args); + } + + public String recv_withError() throws org.apache.thrift.TException { + withError_result result = new withError_result(); + receiveBase(result, "withError"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withError failed: unknown result"); + } + + public String withCollisioin(String input) throws org.apache.thrift.TException { + send_withCollisioin(input); + return recv_withCollisioin(); + } + + public void send_withCollisioin(String input) throws org.apache.thrift.TException { + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + sendBase("withCollisioin", args); + } + + public String recv_withCollisioin() throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + receiveBase(result, "withCollisioin"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withCollisioin failed: unknown result"); + } + + public void noReturn(int delay) throws org.apache.thrift.TException { + send_noReturn(delay); + recv_noReturn(); + } + + public void send_noReturn(int delay) throws org.apache.thrift.TException { + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + sendBase("noReturn", args); + } + + public void recv_noReturn() throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + receiveBase(result, "noReturn"); + return; + } + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException { + send_oneWayHasArgs(delay); + } + + public void send_oneWayHasArgs(int delay) throws org.apache.thrift.TException { + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + sendBase("oneWayHasArgs", args); + } + + public void oneWay() throws org.apache.thrift.TException { + send_oneWay(); + } + + public void send_oneWay() throws org.apache.thrift.TException { + oneWay_args args = new oneWay_args(); + sendBase("oneWay", args); + } + + public void oneWayWithError() throws org.apache.thrift.TException { + send_oneWayWithError(); + } + + public void send_oneWayWithError() throws org.apache.thrift.TException { + oneWayWithError_args args = new oneWayWithError_args(); + sendBase("oneWayWithError", args); + } + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException { + send_data(user, account); + return recv_data(); + } + + public void send_data(User user, Account account) throws org.apache.thrift.TException { + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + sendBase("data", args); + } + + public UserAccount recv_data() throws org.apache.thrift.TException { + data_result result = new data_result(); + receiveBase(result, "data"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, "data failed: unknown result"); + } + } + + public static class AsyncClient extends org.apache.thrift.async.TAsyncClient + implements AsyncIface { + public static class Factory + implements org.apache.thrift.async.TAsyncClientFactory { + private org.apache.thrift.async.TAsyncClientManager clientManager; + private org.apache.thrift.protocol.TProtocolFactory protocolFactory; + + public Factory( + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.protocol.TProtocolFactory protocolFactory) { + this.clientManager = clientManager; + this.protocolFactory = protocolFactory; + } + + public AsyncClient getAsyncClient( + org.apache.thrift.transport.TNonblockingTransport transport) { + return new AsyncClient(protocolFactory, clientManager, transport); + } + } + + public AsyncClient( + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.transport.TNonblockingTransport transport) { + super(protocolFactory, clientManager, transport); + } + + public void sayHello( + String zone, String name, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + sayHello_call method_call = + new sayHello_call(zone, name, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class sayHello_call extends org.apache.thrift.async.TAsyncMethodCall { + private String zone; + private String name; + + public sayHello_call( + String zone, + String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.zone = zone; + this.name = name; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "sayHello", org.apache.thrift.protocol.TMessageType.CALL, 0)); + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_sayHello(); + } + } + + public void withDelay(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withDelay_call method_call = + new withDelay_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withDelay_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public withDelay_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withDelay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withDelay(); + } + } + + public void withoutArgs(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withoutArgs_call method_call = + new withoutArgs_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withoutArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + public withoutArgs_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withoutArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withoutArgs_args args = new withoutArgs_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withoutArgs(); + } + } + + public void withError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withError_call method_call = + new withError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withError_call extends org.apache.thrift.async.TAsyncMethodCall { + public withError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withError_args args = new withError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withError(); + } + } + + public void withCollisioin( + String input, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withCollisioin_call method_call = + new withCollisioin_call(input, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withCollisioin_call extends org.apache.thrift.async.TAsyncMethodCall { + private String input; + + public withCollisioin_call( + String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.input = input; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withCollisioin", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withCollisioin(); + } + } + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + noReturn_call method_call = + new noReturn_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class noReturn_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public noReturn_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "noReturn", org.apache.thrift.protocol.TMessageType.CALL, 0)); + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + (new Client(prot)).recv_noReturn(); + } + } + + public void oneWayHasArgs(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayHasArgs_call method_call = + new oneWayHasArgs_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayHasArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public oneWayHasArgs_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayHasArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWay_call method_call = + new oneWay_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWay_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWay_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + oneWay_args args = new oneWay_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayWithError_call method_call = + new oneWayWithError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayWithError_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWayWithError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayWithError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + oneWayWithError_args args = new oneWayWithError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void data( + User user, Account account, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + data_call method_call = + new data_call(user, account, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class data_call extends org.apache.thrift.async.TAsyncMethodCall { + private User user; + private Account account; + + public data_call( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.user = user; + this.account = account; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "data", org.apache.thrift.protocol.TMessageType.CALL, 0)); + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + args.write(prot); + prot.writeMessageEnd(); + } + + public UserAccount getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_data(); + } + } + } + + public static class Processor extends org.apache.thrift.TBaseProcessor + implements org.apache.thrift.TProcessor { + private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); + + public Processor(I iface) { + super( + iface, + getProcessMap( + new HashMap< + String, + org.apache.thrift.ProcessFunction>())); + } + + protected Processor( + I iface, + Map> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + Map> + getProcessMap( + Map> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.ProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + protected boolean isOneway() { + return false; + } + + public sayHello_result getResult(I iface, sayHello_args args) + throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + result.success = iface.sayHello(args.zone, args.name); + return result; + } + } + + public static class withDelay + extends org.apache.thrift.ProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + protected boolean isOneway() { + return false; + } + + public withDelay_result getResult(I iface, withDelay_args args) + throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + result.success = iface.withDelay(args.delay); + return result; + } + } + + public static class withoutArgs + extends org.apache.thrift.ProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + protected boolean isOneway() { + return false; + } + + public withoutArgs_result getResult(I iface, withoutArgs_args args) + throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + result.success = iface.withoutArgs(); + return result; + } + } + + public static class withError + extends org.apache.thrift.ProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + protected boolean isOneway() { + return false; + } + + public withError_result getResult(I iface, withError_args args) + throws org.apache.thrift.TException { + withError_result result = new withError_result(); + result.success = iface.withError(); + return result; + } + } + + public static class withCollisioin + extends org.apache.thrift.ProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + protected boolean isOneway() { + return false; + } + + public withCollisioin_result getResult(I iface, withCollisioin_args args) + throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + result.success = iface.withCollisioin(args.input); + return result; + } + } + + public static class noReturn + extends org.apache.thrift.ProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + protected boolean isOneway() { + return false; + } + + public noReturn_result getResult(I iface, noReturn_args args) + throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + iface.noReturn(args.delay); + return result; + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.ProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + protected boolean isOneway() { + return true; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayHasArgs_args args) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay); + return null; + } + } + + public static class oneWay + extends org.apache.thrift.ProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + protected boolean isOneway() { + return true; + } + + public org.apache.thrift.TBase getResult(I iface, oneWay_args args) + throws org.apache.thrift.TException { + iface.oneWay(); + return null; + } + } + + public static class oneWayWithError + extends org.apache.thrift.ProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + protected boolean isOneway() { + return true; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayWithError_args args) + throws org.apache.thrift.TException { + iface.oneWayWithError(); + return null; + } + } + + public static class data + extends org.apache.thrift.ProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + protected boolean isOneway() { + return false; + } + + public data_result getResult(I iface, data_args args) throws org.apache.thrift.TException { + data_result result = new data_result(); + result.success = iface.data(args.user, args.account); + return result; + } + } + } + + public static class AsyncProcessor + extends org.apache.thrift.TBaseAsyncProcessor { + private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); + + public AsyncProcessor(I iface) { + super( + iface, + getProcessMap( + new HashMap< + String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>>())); + } + + protected AsyncProcessor( + I iface, + Map> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + Map> + getProcessMap( + Map< + String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.AsyncProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(String o) { + sayHello_result result = new sayHello_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + sayHello_result result = new sayHello_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + sayHello_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + iface.sayHello(args.zone, args.name, resultHandler); + } + } + + public static class withDelay + extends org.apache.thrift.AsyncProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(String o) { + withDelay_result result = new withDelay_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + withDelay_result result = new withDelay_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withDelay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + iface.withDelay(args.delay, resultHandler); + } + } + + public static class withoutArgs + extends org.apache.thrift.AsyncProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(String o) { + withoutArgs_result result = new withoutArgs_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + withoutArgs_result result = new withoutArgs_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withoutArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + iface.withoutArgs(resultHandler); + } + } + + public static class withError + extends org.apache.thrift.AsyncProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(String o) { + withError_result result = new withError_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + withError_result result = new withError_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + iface.withError(resultHandler); + } + } + + public static class withCollisioin + extends org.apache.thrift.AsyncProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(String o) { + withCollisioin_result result = new withCollisioin_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + withCollisioin_result result = new withCollisioin_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withCollisioin_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + iface.withCollisioin(args.input, resultHandler); + } + } + + public static class noReturn + extends org.apache.thrift.AsyncProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Void o) { + noReturn_result result = new noReturn_result(); + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + noReturn_result result = new noReturn_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + noReturn_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + iface.noReturn(args.delay, resultHandler); + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.AsyncProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(Exception e) {} + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWayHasArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + iface.oneWayHasArgs(args.delay, resultHandler); + } + } + + public static class oneWay + extends org.apache.thrift.AsyncProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(Exception e) {} + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + iface.oneWay(resultHandler); + } + } + + public static class oneWayWithError + extends org.apache.thrift.AsyncProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(Exception e) {} + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWayWithError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + iface.oneWayWithError(resultHandler); + } + } + + public static class data + extends org.apache.thrift.AsyncProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(UserAccount o) { + data_result result = new data_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + data_result result = new data_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + data_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + iface.data(args.user, args.account, resultHandler); + } + } + } + + public static class sayHello_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_args"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new sayHello_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new sayHello_argsTupleSchemeFactory()); + } + + public String zone; // required + public String name; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + NAME((short) 2, "name"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // NAME + return NAME; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_args.class, metaDataMap); + } + + public sayHello_args() {} + + public sayHello_args(String zone, String name) { + this(); + this.zone = zone; + this.name = name; + } + + /** Performs a deep copy on other. */ + public sayHello_args(sayHello_args other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetName()) { + this.name = other.name; + } + } + + public sayHello_args deepCopy() { + return new sayHello_args(this); + } + + @Override + public void clear() { + this.zone = null; + this.name = null; + } + + public String getZone() { + return this.zone; + } + + public sayHello_args setZone(String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + public String getName() { + return this.name; + } + + public sayHello_args setName(String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((String) value); + } + break; + + case NAME: + if (value == null) { + unsetName(); + } else { + setName((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case NAME: + return getName(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case NAME: + return isSetName(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof sayHello_args) return this.equals((sayHello_args) that); + return false; + } + + public boolean equals(sayHello_args that) { + if (that == null) return false; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(sayHello_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetZone()).compareTo(other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("sayHello_args("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_argsStandardSchemeFactory implements SchemeFactory { + public sayHello_argsStandardScheme getScheme() { + return new sayHello_argsStandardScheme(); + } + } + + private static class sayHello_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_argsTupleSchemeFactory implements SchemeFactory { + public sayHello_argsTupleScheme getScheme() { + return new sayHello_argsTupleScheme(); + } + } + + private static class sayHello_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetZone()) { + optionals.set(0); + } + if (struct.isSetName()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetZone()) { + oprot.writeString(struct.zone); + } + if (struct.isSetName()) { + oprot.writeString(struct.name); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } + if (incoming.get(1)) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } + } + } + } + + public static class sayHello_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new sayHello_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new sayHello_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_result.class, metaDataMap); + } + + public sayHello_result() {} + + public sayHello_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public sayHello_result(sayHello_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public sayHello_result deepCopy() { + return new sayHello_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public sayHello_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof sayHello_result) return this.equals((sayHello_result) that); + return false; + } + + public boolean equals(sayHello_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(sayHello_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("sayHello_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_resultStandardSchemeFactory implements SchemeFactory { + public sayHello_resultStandardScheme getScheme() { + return new sayHello_resultStandardScheme(); + } + } + + private static class sayHello_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_resultTupleSchemeFactory implements SchemeFactory { + public sayHello_resultTupleScheme getScheme() { + return new sayHello_resultTupleScheme(); + } + } + + private static class sayHello_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withDelay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withDelay_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withDelay_argsTupleSchemeFactory()); + } + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_args.class, metaDataMap); + } + + public withDelay_args() {} + + public withDelay_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public withDelay_args(withDelay_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public withDelay_args deepCopy() { + return new withDelay_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public withDelay_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return Integer.valueOf(getDelay()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withDelay_args) return this.equals((withDelay_args) that); + return false; + } + + public boolean equals(withDelay_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(withDelay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withDelay_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_argsStandardSchemeFactory implements SchemeFactory { + public withDelay_argsStandardScheme getScheme() { + return new withDelay_argsStandardScheme(); + } + } + + private static class withDelay_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_argsTupleSchemeFactory implements SchemeFactory { + public withDelay_argsTupleScheme getScheme() { + return new withDelay_argsTupleScheme(); + } + } + + private static class withDelay_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + } + + public static class withDelay_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withDelay_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withDelay_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_result.class, metaDataMap); + } + + public withDelay_result() {} + + public withDelay_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withDelay_result(withDelay_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withDelay_result deepCopy() { + return new withDelay_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withDelay_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withDelay_result) return this.equals((withDelay_result) that); + return false; + } + + public boolean equals(withDelay_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(withDelay_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withDelay_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_resultStandardSchemeFactory implements SchemeFactory { + public withDelay_resultStandardScheme getScheme() { + return new withDelay_resultStandardScheme(); + } + } + + private static class withDelay_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_resultTupleSchemeFactory implements SchemeFactory { + public withDelay_resultTupleScheme getScheme() { + return new withDelay_resultTupleScheme(); + } + } + + private static class withDelay_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withoutArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withoutArgs_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withoutArgs_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_args.class, metaDataMap); + } + + public withoutArgs_args() {} + + /** Performs a deep copy on other. */ + public withoutArgs_args(withoutArgs_args other) {} + + public withoutArgs_args deepCopy() { + return new withoutArgs_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withoutArgs_args) return this.equals((withoutArgs_args) that); + return false; + } + + public boolean equals(withoutArgs_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(withoutArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withoutArgs_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_argsStandardSchemeFactory implements SchemeFactory { + public withoutArgs_argsStandardScheme getScheme() { + return new withoutArgs_argsStandardScheme(); + } + } + + private static class withoutArgs_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_argsTupleSchemeFactory implements SchemeFactory { + public withoutArgs_argsTupleScheme getScheme() { + return new withoutArgs_argsTupleScheme(); + } + } + + private static class withoutArgs_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class withoutArgs_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withoutArgs_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withoutArgs_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_result.class, metaDataMap); + } + + public withoutArgs_result() {} + + public withoutArgs_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withoutArgs_result(withoutArgs_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withoutArgs_result deepCopy() { + return new withoutArgs_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withoutArgs_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withoutArgs_result) return this.equals((withoutArgs_result) that); + return false; + } + + public boolean equals(withoutArgs_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(withoutArgs_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withoutArgs_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_resultStandardSchemeFactory implements SchemeFactory { + public withoutArgs_resultStandardScheme getScheme() { + return new withoutArgs_resultStandardScheme(); + } + } + + private static class withoutArgs_resultStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_resultTupleSchemeFactory implements SchemeFactory { + public withoutArgs_resultTupleScheme getScheme() { + return new withoutArgs_resultTupleScheme(); + } + } + + private static class withoutArgs_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withError_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withError_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_args.class, metaDataMap); + } + + public withError_args() {} + + /** Performs a deep copy on other. */ + public withError_args(withError_args other) {} + + public withError_args deepCopy() { + return new withError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withError_args) return this.equals((withError_args) that); + return false; + } + + public boolean equals(withError_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(withError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_argsStandardSchemeFactory implements SchemeFactory { + public withError_argsStandardScheme getScheme() { + return new withError_argsStandardScheme(); + } + } + + private static class withError_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_argsTupleSchemeFactory implements SchemeFactory { + public withError_argsTupleScheme getScheme() { + return new withError_argsTupleScheme(); + } + } + + private static class withError_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class withError_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withError_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withError_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_result.class, metaDataMap); + } + + public withError_result() {} + + public withError_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withError_result(withError_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withError_result deepCopy() { + return new withError_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withError_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withError_result) return this.equals((withError_result) that); + return false; + } + + public boolean equals(withError_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(withError_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withError_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_resultStandardSchemeFactory implements SchemeFactory { + public withError_resultStandardScheme getScheme() { + return new withError_resultStandardScheme(); + } + } + + private static class withError_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_resultTupleSchemeFactory implements SchemeFactory { + public withError_resultTupleScheme getScheme() { + return new withError_resultTupleScheme(); + } + } + + private static class withError_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withCollisioin_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_args"); + + private static final org.apache.thrift.protocol.TField INPUT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "input", org.apache.thrift.protocol.TType.STRING, (short) 3333); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withCollisioin_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withCollisioin_argsTupleSchemeFactory()); + } + + public String input; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + INPUT((short) 3333, "input"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 3333: // INPUT + return INPUT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.INPUT, + new org.apache.thrift.meta_data.FieldMetaData( + "input", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_args.class, metaDataMap); + } + + public withCollisioin_args() {} + + public withCollisioin_args(String input) { + this(); + this.input = input; + } + + /** Performs a deep copy on other. */ + public withCollisioin_args(withCollisioin_args other) { + if (other.isSetInput()) { + this.input = other.input; + } + } + + public withCollisioin_args deepCopy() { + return new withCollisioin_args(this); + } + + @Override + public void clear() { + this.input = null; + } + + public String getInput() { + return this.input; + } + + public withCollisioin_args setInput(String input) { + this.input = input; + return this; + } + + public void unsetInput() { + this.input = null; + } + + /** Returns true if field input is set (has been assigned a value) and false otherwise */ + public boolean isSetInput() { + return this.input != null; + } + + public void setInputIsSet(boolean value) { + if (!value) { + this.input = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case INPUT: + if (value == null) { + unsetInput(); + } else { + setInput((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case INPUT: + return getInput(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case INPUT: + return isSetInput(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withCollisioin_args) return this.equals((withCollisioin_args) that); + return false; + } + + public boolean equals(withCollisioin_args that) { + if (that == null) return false; + + boolean this_present_input = true && this.isSetInput(); + boolean that_present_input = true && that.isSetInput(); + if (this_present_input || that_present_input) { + if (!(this_present_input && that_present_input)) return false; + if (!this.input.equals(that.input)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(withCollisioin_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetInput()).compareTo(other.isSetInput()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInput()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.input, other.input); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withCollisioin_args("); + boolean first = true; + + sb.append("input:"); + if (this.input == null) { + sb.append("null"); + } else { + sb.append(this.input); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_argsStandardSchemeFactory implements SchemeFactory { + public withCollisioin_argsStandardScheme getScheme() { + return new withCollisioin_argsStandardScheme(); + } + } + + private static class withCollisioin_argsStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 3333: // INPUT + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.input != null) { + oprot.writeFieldBegin(INPUT_FIELD_DESC); + oprot.writeString(struct.input); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_argsTupleSchemeFactory implements SchemeFactory { + public withCollisioin_argsTupleScheme getScheme() { + return new withCollisioin_argsTupleScheme(); + } + } + + private static class withCollisioin_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetInput()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetInput()) { + oprot.writeString(struct.input); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } + } + } + } + + public static class withCollisioin_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withCollisioin_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withCollisioin_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_result.class, metaDataMap); + } + + public withCollisioin_result() {} + + public withCollisioin_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withCollisioin_result(withCollisioin_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withCollisioin_result deepCopy() { + return new withCollisioin_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withCollisioin_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withCollisioin_result) return this.equals((withCollisioin_result) that); + return false; + } + + public boolean equals(withCollisioin_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(withCollisioin_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withCollisioin_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_resultStandardSchemeFactory implements SchemeFactory { + public withCollisioin_resultStandardScheme getScheme() { + return new withCollisioin_resultStandardScheme(); + } + } + + private static class withCollisioin_resultStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_resultTupleSchemeFactory implements SchemeFactory { + public withCollisioin_resultTupleScheme getScheme() { + return new withCollisioin_resultTupleScheme(); + } + } + + private static class withCollisioin_resultTupleScheme + extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class noReturn_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new noReturn_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new noReturn_argsTupleSchemeFactory()); + } + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_args.class, metaDataMap); + } + + public noReturn_args() {} + + public noReturn_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public noReturn_args(noReturn_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public noReturn_args deepCopy() { + return new noReturn_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public noReturn_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return Integer.valueOf(getDelay()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof noReturn_args) return this.equals((noReturn_args) that); + return false; + } + + public boolean equals(noReturn_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(noReturn_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("noReturn_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_argsStandardSchemeFactory implements SchemeFactory { + public noReturn_argsStandardScheme getScheme() { + return new noReturn_argsStandardScheme(); + } + } + + private static class noReturn_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_argsTupleSchemeFactory implements SchemeFactory { + public noReturn_argsTupleScheme getScheme() { + return new noReturn_argsTupleScheme(); + } + } + + private static class noReturn_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + } + + public static class noReturn_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_result"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new noReturn_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new noReturn_resultTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_result.class, metaDataMap); + } + + public noReturn_result() {} + + /** Performs a deep copy on other. */ + public noReturn_result(noReturn_result other) {} + + public noReturn_result deepCopy() { + return new noReturn_result(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof noReturn_result) return this.equals((noReturn_result) that); + return false; + } + + public boolean equals(noReturn_result that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(noReturn_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("noReturn_result("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_resultStandardSchemeFactory implements SchemeFactory { + public noReturn_resultStandardScheme getScheme() { + return new noReturn_resultStandardScheme(); + } + } + + private static class noReturn_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_resultTupleSchemeFactory implements SchemeFactory { + public noReturn_resultTupleScheme getScheme() { + return new noReturn_resultTupleScheme(); + } + } + + private static class noReturn_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class oneWayHasArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayHasArgs_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new oneWayHasArgs_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new oneWayHasArgs_argsTupleSchemeFactory()); + } + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayHasArgs_args.class, metaDataMap); + } + + public oneWayHasArgs_args() {} + + public oneWayHasArgs_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public oneWayHasArgs_args(oneWayHasArgs_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public oneWayHasArgs_args deepCopy() { + return new oneWayHasArgs_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public oneWayHasArgs_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return Integer.valueOf(getDelay()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWayHasArgs_args) return this.equals((oneWayHasArgs_args) that); + return false; + } + + public boolean equals(oneWayHasArgs_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(oneWayHasArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWayHasArgs_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayHasArgs_argsStandardSchemeFactory implements SchemeFactory { + public oneWayHasArgs_argsStandardScheme getScheme() { + return new oneWayHasArgs_argsStandardScheme(); + } + } + + private static class oneWayHasArgs_argsStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayHasArgs_argsTupleSchemeFactory implements SchemeFactory { + public oneWayHasArgs_argsTupleScheme getScheme() { + return new oneWayHasArgs_argsTupleScheme(); + } + } + + private static class oneWayHasArgs_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + } + + public static class oneWay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWay_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new oneWay_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new oneWay_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWay_args.class, metaDataMap); + } + + public oneWay_args() {} + + /** Performs a deep copy on other. */ + public oneWay_args(oneWay_args other) {} + + public oneWay_args deepCopy() { + return new oneWay_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWay_args) return this.equals((oneWay_args) that); + return false; + } + + public boolean equals(oneWay_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(oneWay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWay_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWay_argsStandardSchemeFactory implements SchemeFactory { + public oneWay_argsStandardScheme getScheme() { + return new oneWay_argsStandardScheme(); + } + } + + private static class oneWay_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWay_argsTupleSchemeFactory implements SchemeFactory { + public oneWay_argsTupleScheme getScheme() { + return new oneWay_argsTupleScheme(); + } + } + + private static class oneWay_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class oneWayWithError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayWithError_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new oneWayWithError_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new oneWayWithError_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayWithError_args.class, metaDataMap); + } + + public oneWayWithError_args() {} + + /** Performs a deep copy on other. */ + public oneWayWithError_args(oneWayWithError_args other) {} + + public oneWayWithError_args deepCopy() { + return new oneWayWithError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWayWithError_args) return this.equals((oneWayWithError_args) that); + return false; + } + + public boolean equals(oneWayWithError_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(oneWayWithError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWayWithError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayWithError_argsStandardSchemeFactory implements SchemeFactory { + public oneWayWithError_argsStandardScheme getScheme() { + return new oneWayWithError_argsStandardScheme(); + } + } + + private static class oneWayWithError_argsStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayWithError_argsTupleSchemeFactory implements SchemeFactory { + public oneWayWithError_argsTupleScheme getScheme() { + return new oneWayWithError_argsTupleScheme(); + } + } + + private static class oneWayWithError_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class data_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_args"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new data_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new data_argsTupleSchemeFactory()); + } + + public User user; // required + public Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(data_args.class, metaDataMap); + } + + public data_args() {} + + public data_args(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public data_args(data_args other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public data_args deepCopy() { + return new data_args(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + public User getUser() { + return this.user; + } + + public data_args setUser(User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + public Account getAccount() { + return this.account; + } + + public data_args setAccount(Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof data_args) return this.equals((data_args) that); + return false; + } + + public boolean equals(data_args that) { + if (that == null) return false; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(data_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetUser()).compareTo(other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAccount()).compareTo(other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("data_args("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_argsStandardSchemeFactory implements SchemeFactory { + public data_argsStandardScheme getScheme() { + return new data_argsStandardScheme(); + } + } + + private static class data_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_argsTupleSchemeFactory implements SchemeFactory { + public data_argsTupleScheme getScheme() { + return new data_argsTupleScheme(); + } + } + + private static class data_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetUser()) { + optionals.set(0); + } + if (struct.isSetAccount()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetUser()) { + struct.user.write(oprot); + } + if (struct.isSetAccount()) { + struct.account.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } + if (incoming.get(1)) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + } + } + + public static class data_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRUCT, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new data_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new data_resultTupleSchemeFactory()); + } + + public UserAccount success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, UserAccount.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + data_result.class, metaDataMap); + } + + public data_result() {} + + public data_result(UserAccount success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public data_result(data_result other) { + if (other.isSetSuccess()) { + this.success = new UserAccount(other.success); + } + } + + public data_result deepCopy() { + return new data_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public UserAccount getSuccess() { + return this.success; + } + + public data_result setSuccess(UserAccount success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((UserAccount) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof data_result) return this.equals((data_result) that); + return false; + } + + public boolean equals(data_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(data_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("data_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_resultStandardSchemeFactory implements SchemeFactory { + public data_resultStandardScheme getScheme() { + return new data_resultStandardScheme(); + } + } + + private static class data_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_resultTupleSchemeFactory implements SchemeFactory { + public data_resultTupleScheme getScheme() { + return new data_resultTupleScheme(); + } + } + + private static class data_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_1/User.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_1/User.java new file mode 100644 index 000000000000..e153c5431162 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_1/User.java @@ -0,0 +1,579 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_9_1; + +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.server.AbstractNonblockingServer.*; + +public class User + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("User"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "userId", org.apache.thrift.protocol.TType.STRING, (short) 2); + private static final org.apache.thrift.protocol.TField AGE_FIELD_DESC = + new org.apache.thrift.protocol.TField("age", org.apache.thrift.protocol.TType.I32, (short) 3); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new UserStandardSchemeFactory()); + schemes.put(TupleScheme.class, new UserTupleSchemeFactory()); + } + + public String name; // required + public String userId; // required + public int age; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + NAME((short) 1, "name"), + USER_ID((short) 2, "userId"), + AGE((short) 3, "age"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // NAME + return NAME; + case 2: // USER_ID + return USER_ID; + case 3: // AGE + return AGE; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __AGE_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.USER_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "userId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.AGE, + new org.apache.thrift.meta_data.FieldMetaData( + "age", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(User.class, metaDataMap); + } + + public User() {} + + public User(String name, String userId, int age) { + this(); + this.name = name; + this.userId = userId; + this.age = age; + setAgeIsSet(true); + } + + /** Performs a deep copy on other. */ + public User(User other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetName()) { + this.name = other.name; + } + if (other.isSetUserId()) { + this.userId = other.userId; + } + this.age = other.age; + } + + public User deepCopy() { + return new User(this); + } + + @Override + public void clear() { + this.name = null; + this.userId = null; + setAgeIsSet(false); + this.age = 0; + } + + public String getName() { + return this.name; + } + + public User setName(String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public String getUserId() { + return this.userId; + } + + public User setUserId(String userId) { + this.userId = userId; + return this; + } + + public void unsetUserId() { + this.userId = null; + } + + /** Returns true if field userId is set (has been assigned a value) and false otherwise */ + public boolean isSetUserId() { + return this.userId != null; + } + + public void setUserIdIsSet(boolean value) { + if (!value) { + this.userId = null; + } + } + + public int getAge() { + return this.age; + } + + public User setAge(int age) { + this.age = age; + setAgeIsSet(true); + return this; + } + + public void unsetAge() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __AGE_ISSET_ID); + } + + /** Returns true if field age is set (has been assigned a value) and false otherwise */ + public boolean isSetAge() { + return EncodingUtils.testBit(__isset_bitfield, __AGE_ISSET_ID); + } + + public void setAgeIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __AGE_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case NAME: + if (value == null) { + unsetName(); + } else { + setName((String) value); + } + break; + + case USER_ID: + if (value == null) { + unsetUserId(); + } else { + setUserId((String) value); + } + break; + + case AGE: + if (value == null) { + unsetAge(); + } else { + setAge((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case NAME: + return getName(); + + case USER_ID: + return getUserId(); + + case AGE: + return Integer.valueOf(getAge()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case NAME: + return isSetName(); + case USER_ID: + return isSetUserId(); + case AGE: + return isSetAge(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof User) return this.equals((User) that); + return false; + } + + public boolean equals(User that) { + if (that == null) return false; + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + boolean this_present_userId = true && this.isSetUserId(); + boolean that_present_userId = true && that.isSetUserId(); + if (this_present_userId || that_present_userId) { + if (!(this_present_userId && that_present_userId)) return false; + if (!this.userId.equals(that.userId)) return false; + } + + boolean this_present_age = true; + boolean that_present_age = true; + if (this_present_age || that_present_age) { + if (!(this_present_age && that_present_age)) return false; + if (this.age != that.age) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(User other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetUserId()).compareTo(other.isSetUserId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAge()).compareTo(other.isSetAge()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAge()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.age, other.age); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("User("); + boolean first = true; + + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + if (!first) sb.append(", "); + sb.append("userId:"); + if (this.userId == null) { + sb.append("null"); + } else { + sb.append(this.userId); + } + first = false; + if (!first) sb.append(", "); + sb.append("age:"); + sb.append(this.age); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (name == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'name' was not present! Struct: " + toString()); + } + if (userId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'userId' was not present! Struct: " + toString()); + } + // alas, we cannot check 'age' because it's a primitive and you chose the non-beans generator. + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserStandardSchemeFactory implements SchemeFactory { + public UserStandardScheme getScheme() { + return new UserStandardScheme(); + } + } + + private static class UserStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // AGE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + if (!struct.isSetAge()) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'age' was not found in serialized data! Struct: " + toString()); + } + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, User struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + if (struct.userId != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userId); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(AGE_FIELD_DESC); + oprot.writeI32(struct.age); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserTupleSchemeFactory implements SchemeFactory { + public UserTupleScheme getScheme() { + return new UserTupleScheme(); + } + } + + private static class UserTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeString(struct.name); + oprot.writeString(struct.userId); + oprot.writeI32(struct.age); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.name = iprot.readString(); + struct.setNameIsSet(true); + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_1/UserAccount.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_1/UserAccount.java new file mode 100644 index 000000000000..b494c11d2fb7 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_1/UserAccount.java @@ -0,0 +1,488 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_9_1; + +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.server.AbstractNonblockingServer.*; + +public class UserAccount + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("UserAccount"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new UserAccountStandardSchemeFactory()); + schemes.put(TupleScheme.class, new UserAccountTupleSchemeFactory()); + } + + public User user; // required + public Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserAccount.class, metaDataMap); + } + + public UserAccount() {} + + public UserAccount(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public UserAccount(UserAccount other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public UserAccount deepCopy() { + return new UserAccount(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + public User getUser() { + return this.user; + } + + public UserAccount setUser(User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + public Account getAccount() { + return this.account; + } + + public UserAccount setAccount(Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof UserAccount) return this.equals((UserAccount) that); + return false; + } + + public boolean equals(UserAccount that) { + if (that == null) return false; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(UserAccount other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetUser()).compareTo(other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAccount()).compareTo(other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("UserAccount("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (user == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'user' was not present! Struct: " + toString()); + } + if (account == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'account' was not present! Struct: " + toString()); + } + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserAccountStandardSchemeFactory implements SchemeFactory { + public UserAccountStandardScheme getScheme() { + return new UserAccountStandardScheme(); + } + } + + private static class UserAccountStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, UserAccount struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserAccountTupleSchemeFactory implements SchemeFactory { + public UserAccountTupleScheme getScheme() { + return new UserAccountTupleScheme(); + } + } + + private static class UserAccountTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + struct.user.write(oprot); + struct.account.write(oprot); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_2/Account.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_2/Account.java new file mode 100644 index 000000000000..a9dbbe8e32b3 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_2/Account.java @@ -0,0 +1,493 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_9_2; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.server.AbstractNonblockingServer.*; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2025-2-27") +public class Account + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("Account"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField CARD_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "cardId", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new AccountStandardSchemeFactory()); + schemes.put(TupleScheme.class, new AccountTupleSchemeFactory()); + } + + public String zone; // required + public String cardId; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + CARD_ID((short) 2, "cardId"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // CARD_ID + return CARD_ID; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.CARD_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "cardId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Account.class, metaDataMap); + } + + public Account() {} + + public Account(String zone, String cardId) { + this(); + this.zone = zone; + this.cardId = cardId; + } + + /** Performs a deep copy on other. */ + public Account(Account other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetCardId()) { + this.cardId = other.cardId; + } + } + + public Account deepCopy() { + return new Account(this); + } + + @Override + public void clear() { + this.zone = null; + this.cardId = null; + } + + public String getZone() { + return this.zone; + } + + public Account setZone(String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + public String getCardId() { + return this.cardId; + } + + public Account setCardId(String cardId) { + this.cardId = cardId; + return this; + } + + public void unsetCardId() { + this.cardId = null; + } + + /** Returns true if field cardId is set (has been assigned a value) and false otherwise */ + public boolean isSetCardId() { + return this.cardId != null; + } + + public void setCardIdIsSet(boolean value) { + if (!value) { + this.cardId = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((String) value); + } + break; + + case CARD_ID: + if (value == null) { + unsetCardId(); + } else { + setCardId((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case CARD_ID: + return getCardId(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case CARD_ID: + return isSetCardId(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof Account) return this.equals((Account) that); + return false; + } + + public boolean equals(Account that) { + if (that == null) return false; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_cardId = true && this.isSetCardId(); + boolean that_present_cardId = true && that.isSetCardId(); + if (this_present_cardId || that_present_cardId) { + if (!(this_present_cardId && that_present_cardId)) return false; + if (!this.cardId.equals(that.cardId)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_zone = true && (isSetZone()); + list.add(present_zone); + if (present_zone) list.add(zone); + + boolean present_cardId = true && (isSetCardId()); + list.add(present_cardId); + if (present_cardId) list.add(cardId); + + return list.hashCode(); + } + + @Override + public int compareTo(Account other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetZone()).compareTo(other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetCardId()).compareTo(other.isSetCardId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCardId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cardId, other.cardId); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("Account("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("cardId:"); + if (this.cardId == null) { + sb.append("null"); + } else { + sb.append(this.cardId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (zone == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'zone' was not present! Struct: " + toString()); + } + if (cardId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'cardId' was not present! Struct: " + toString()); + } + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class AccountStandardSchemeFactory implements SchemeFactory { + public AccountStandardScheme getScheme() { + return new AccountStandardScheme(); + } + } + + private static class AccountStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // CARD_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, Account struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.cardId != null) { + oprot.writeFieldBegin(CARD_ID_FIELD_DESC); + oprot.writeString(struct.cardId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class AccountTupleSchemeFactory implements SchemeFactory { + public AccountTupleScheme getScheme() { + return new AccountTupleScheme(); + } + } + + private static class AccountTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeString(struct.zone); + oprot.writeString(struct.cardId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_2/ThriftService.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_2/ThriftService.java new file mode 100644 index 000000000000..8a6a68c6a042 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_2/ThriftService.java @@ -0,0 +1,7635 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_9_2; + +import java.util.ArrayList; +import java.util.BitSet; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.server.AbstractNonblockingServer.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2025-2-27") +public class ThriftService { + + public interface Iface { + + public String sayHello(String zone, String name) throws org.apache.thrift.TException; + + public String withDelay(int delay) throws org.apache.thrift.TException; + + public String withoutArgs() throws org.apache.thrift.TException; + + public String withError() throws org.apache.thrift.TException; + + public String withCollisioin(String input) throws org.apache.thrift.TException; + + public void noReturn(int delay) throws org.apache.thrift.TException; + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException; + + public void oneWay() throws org.apache.thrift.TException; + + public void oneWayWithError() throws org.apache.thrift.TException; + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException; + } + + public interface AsyncIface { + + public void sayHello( + String zone, String name, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withDelay(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withoutArgs(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withCollisioin( + String input, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayHasArgs(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void data( + User user, Account account, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + } + + public static class Client extends org.apache.thrift.TServiceClient implements Iface { + public static class Factory implements org.apache.thrift.TServiceClientFactory { + public Factory() {} + + public Client getClient(org.apache.thrift.protocol.TProtocol prot) { + return new Client(prot); + } + + public Client getClient( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + return new Client(iprot, oprot); + } + } + + public Client(org.apache.thrift.protocol.TProtocol prot) { + super(prot, prot); + } + + public Client( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + super(iprot, oprot); + } + + public String sayHello(String zone, String name) throws org.apache.thrift.TException { + send_sayHello(zone, name); + return recv_sayHello(); + } + + public void send_sayHello(String zone, String name) throws org.apache.thrift.TException { + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + sendBase("sayHello", args); + } + + public String recv_sayHello() throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + receiveBase(result, "sayHello"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "sayHello failed: unknown result"); + } + + public String withDelay(int delay) throws org.apache.thrift.TException { + send_withDelay(delay); + return recv_withDelay(); + } + + public void send_withDelay(int delay) throws org.apache.thrift.TException { + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + sendBase("withDelay", args); + } + + public String recv_withDelay() throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + receiveBase(result, "withDelay"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withDelay failed: unknown result"); + } + + public String withoutArgs() throws org.apache.thrift.TException { + send_withoutArgs(); + return recv_withoutArgs(); + } + + public void send_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_args args = new withoutArgs_args(); + sendBase("withoutArgs", args); + } + + public String recv_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + receiveBase(result, "withoutArgs"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withoutArgs failed: unknown result"); + } + + public String withError() throws org.apache.thrift.TException { + send_withError(); + return recv_withError(); + } + + public void send_withError() throws org.apache.thrift.TException { + withError_args args = new withError_args(); + sendBase("withError", args); + } + + public String recv_withError() throws org.apache.thrift.TException { + withError_result result = new withError_result(); + receiveBase(result, "withError"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withError failed: unknown result"); + } + + public String withCollisioin(String input) throws org.apache.thrift.TException { + send_withCollisioin(input); + return recv_withCollisioin(); + } + + public void send_withCollisioin(String input) throws org.apache.thrift.TException { + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + sendBase("withCollisioin", args); + } + + public String recv_withCollisioin() throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + receiveBase(result, "withCollisioin"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withCollisioin failed: unknown result"); + } + + public void noReturn(int delay) throws org.apache.thrift.TException { + send_noReturn(delay); + recv_noReturn(); + } + + public void send_noReturn(int delay) throws org.apache.thrift.TException { + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + sendBase("noReturn", args); + } + + public void recv_noReturn() throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + receiveBase(result, "noReturn"); + return; + } + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException { + send_oneWayHasArgs(delay); + } + + public void send_oneWayHasArgs(int delay) throws org.apache.thrift.TException { + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + sendBase("oneWayHasArgs", args); + } + + public void oneWay() throws org.apache.thrift.TException { + send_oneWay(); + } + + public void send_oneWay() throws org.apache.thrift.TException { + oneWay_args args = new oneWay_args(); + sendBase("oneWay", args); + } + + public void oneWayWithError() throws org.apache.thrift.TException { + send_oneWayWithError(); + } + + public void send_oneWayWithError() throws org.apache.thrift.TException { + oneWayWithError_args args = new oneWayWithError_args(); + sendBase("oneWayWithError", args); + } + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException { + send_data(user, account); + return recv_data(); + } + + public void send_data(User user, Account account) throws org.apache.thrift.TException { + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + sendBase("data", args); + } + + public UserAccount recv_data() throws org.apache.thrift.TException { + data_result result = new data_result(); + receiveBase(result, "data"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, "data failed: unknown result"); + } + } + + public static class AsyncClient extends org.apache.thrift.async.TAsyncClient + implements AsyncIface { + public static class Factory + implements org.apache.thrift.async.TAsyncClientFactory { + private org.apache.thrift.async.TAsyncClientManager clientManager; + private org.apache.thrift.protocol.TProtocolFactory protocolFactory; + + public Factory( + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.protocol.TProtocolFactory protocolFactory) { + this.clientManager = clientManager; + this.protocolFactory = protocolFactory; + } + + public AsyncClient getAsyncClient( + org.apache.thrift.transport.TNonblockingTransport transport) { + return new AsyncClient(protocolFactory, clientManager, transport); + } + } + + public AsyncClient( + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.transport.TNonblockingTransport transport) { + super(protocolFactory, clientManager, transport); + } + + public void sayHello( + String zone, String name, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + sayHello_call method_call = + new sayHello_call(zone, name, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class sayHello_call extends org.apache.thrift.async.TAsyncMethodCall { + private String zone; + private String name; + + public sayHello_call( + String zone, + String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.zone = zone; + this.name = name; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "sayHello", org.apache.thrift.protocol.TMessageType.CALL, 0)); + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_sayHello(); + } + } + + public void withDelay(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withDelay_call method_call = + new withDelay_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withDelay_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public withDelay_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withDelay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withDelay(); + } + } + + public void withoutArgs(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withoutArgs_call method_call = + new withoutArgs_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withoutArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + public withoutArgs_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withoutArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withoutArgs_args args = new withoutArgs_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withoutArgs(); + } + } + + public void withError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withError_call method_call = + new withError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withError_call extends org.apache.thrift.async.TAsyncMethodCall { + public withError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withError_args args = new withError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withError(); + } + } + + public void withCollisioin( + String input, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withCollisioin_call method_call = + new withCollisioin_call(input, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withCollisioin_call extends org.apache.thrift.async.TAsyncMethodCall { + private String input; + + public withCollisioin_call( + String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.input = input; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withCollisioin", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withCollisioin(); + } + } + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + noReturn_call method_call = + new noReturn_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class noReturn_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public noReturn_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "noReturn", org.apache.thrift.protocol.TMessageType.CALL, 0)); + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + (new Client(prot)).recv_noReturn(); + } + } + + public void oneWayHasArgs(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayHasArgs_call method_call = + new oneWayHasArgs_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayHasArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public oneWayHasArgs_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayHasArgs", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWay_call method_call = + new oneWay_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWay_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWay_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWay", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWay_args args = new oneWay_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayWithError_call method_call = + new oneWayWithError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayWithError_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWayWithError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayWithError", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayWithError_args args = new oneWayWithError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void data( + User user, Account account, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + data_call method_call = + new data_call(user, account, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class data_call extends org.apache.thrift.async.TAsyncMethodCall { + private User user; + private Account account; + + public data_call( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.user = user; + this.account = account; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "data", org.apache.thrift.protocol.TMessageType.CALL, 0)); + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + args.write(prot); + prot.writeMessageEnd(); + } + + public UserAccount getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_data(); + } + } + } + + public static class Processor extends org.apache.thrift.TBaseProcessor + implements org.apache.thrift.TProcessor { + private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); + + public Processor(I iface) { + super( + iface, + getProcessMap( + new HashMap< + String, + org.apache.thrift.ProcessFunction>())); + } + + protected Processor( + I iface, + Map> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + Map> + getProcessMap( + Map> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.ProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + protected boolean isOneway() { + return false; + } + + public sayHello_result getResult(I iface, sayHello_args args) + throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + result.success = iface.sayHello(args.zone, args.name); + return result; + } + } + + public static class withDelay + extends org.apache.thrift.ProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + protected boolean isOneway() { + return false; + } + + public withDelay_result getResult(I iface, withDelay_args args) + throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + result.success = iface.withDelay(args.delay); + return result; + } + } + + public static class withoutArgs + extends org.apache.thrift.ProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + protected boolean isOneway() { + return false; + } + + public withoutArgs_result getResult(I iface, withoutArgs_args args) + throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + result.success = iface.withoutArgs(); + return result; + } + } + + public static class withError + extends org.apache.thrift.ProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + protected boolean isOneway() { + return false; + } + + public withError_result getResult(I iface, withError_args args) + throws org.apache.thrift.TException { + withError_result result = new withError_result(); + result.success = iface.withError(); + return result; + } + } + + public static class withCollisioin + extends org.apache.thrift.ProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + protected boolean isOneway() { + return false; + } + + public withCollisioin_result getResult(I iface, withCollisioin_args args) + throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + result.success = iface.withCollisioin(args.input); + return result; + } + } + + public static class noReturn + extends org.apache.thrift.ProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + protected boolean isOneway() { + return false; + } + + public noReturn_result getResult(I iface, noReturn_args args) + throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + iface.noReturn(args.delay); + return result; + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.ProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + protected boolean isOneway() { + return true; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayHasArgs_args args) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay); + return null; + } + } + + public static class oneWay + extends org.apache.thrift.ProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + protected boolean isOneway() { + return true; + } + + public org.apache.thrift.TBase getResult(I iface, oneWay_args args) + throws org.apache.thrift.TException { + iface.oneWay(); + return null; + } + } + + public static class oneWayWithError + extends org.apache.thrift.ProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + protected boolean isOneway() { + return true; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayWithError_args args) + throws org.apache.thrift.TException { + iface.oneWayWithError(); + return null; + } + } + + public static class data + extends org.apache.thrift.ProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + protected boolean isOneway() { + return false; + } + + public data_result getResult(I iface, data_args args) throws org.apache.thrift.TException { + data_result result = new data_result(); + result.success = iface.data(args.user, args.account); + return result; + } + } + } + + public static class AsyncProcessor + extends org.apache.thrift.TBaseAsyncProcessor { + private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); + + public AsyncProcessor(I iface) { + super( + iface, + getProcessMap( + new HashMap< + String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>>())); + } + + protected AsyncProcessor( + I iface, + Map> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + Map> + getProcessMap( + Map< + String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.AsyncProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(String o) { + sayHello_result result = new sayHello_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + sayHello_result result = new sayHello_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + sayHello_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + iface.sayHello(args.zone, args.name, resultHandler); + } + } + + public static class withDelay + extends org.apache.thrift.AsyncProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(String o) { + withDelay_result result = new withDelay_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + withDelay_result result = new withDelay_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withDelay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + iface.withDelay(args.delay, resultHandler); + } + } + + public static class withoutArgs + extends org.apache.thrift.AsyncProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(String o) { + withoutArgs_result result = new withoutArgs_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + withoutArgs_result result = new withoutArgs_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withoutArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + iface.withoutArgs(resultHandler); + } + } + + public static class withError + extends org.apache.thrift.AsyncProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(String o) { + withError_result result = new withError_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + withError_result result = new withError_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + iface.withError(resultHandler); + } + } + + public static class withCollisioin + extends org.apache.thrift.AsyncProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(String o) { + withCollisioin_result result = new withCollisioin_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + withCollisioin_result result = new withCollisioin_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withCollisioin_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + iface.withCollisioin(args.input, resultHandler); + } + } + + public static class noReturn + extends org.apache.thrift.AsyncProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Void o) { + noReturn_result result = new noReturn_result(); + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + noReturn_result result = new noReturn_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + noReturn_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + iface.noReturn(args.delay, resultHandler); + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.AsyncProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(Exception e) {} + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWayHasArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + iface.oneWayHasArgs(args.delay, resultHandler); + } + } + + public static class oneWay + extends org.apache.thrift.AsyncProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(Exception e) {} + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + iface.oneWay(resultHandler); + } + } + + public static class oneWayWithError + extends org.apache.thrift.AsyncProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(Exception e) {} + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWayWithError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + iface.oneWayWithError(resultHandler); + } + } + + public static class data + extends org.apache.thrift.AsyncProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(UserAccount o) { + data_result result = new data_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + data_result result = new data_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + data_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + iface.data(args.user, args.account, resultHandler); + } + } + } + + public static class sayHello_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_args"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new sayHello_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new sayHello_argsTupleSchemeFactory()); + } + + public String zone; // required + public String name; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + NAME((short) 2, "name"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // NAME + return NAME; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_args.class, metaDataMap); + } + + public sayHello_args() {} + + public sayHello_args(String zone, String name) { + this(); + this.zone = zone; + this.name = name; + } + + /** Performs a deep copy on other. */ + public sayHello_args(sayHello_args other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetName()) { + this.name = other.name; + } + } + + public sayHello_args deepCopy() { + return new sayHello_args(this); + } + + @Override + public void clear() { + this.zone = null; + this.name = null; + } + + public String getZone() { + return this.zone; + } + + public sayHello_args setZone(String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + public String getName() { + return this.name; + } + + public sayHello_args setName(String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((String) value); + } + break; + + case NAME: + if (value == null) { + unsetName(); + } else { + setName((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case NAME: + return getName(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case NAME: + return isSetName(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof sayHello_args) return this.equals((sayHello_args) that); + return false; + } + + public boolean equals(sayHello_args that) { + if (that == null) return false; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_zone = true && (isSetZone()); + list.add(present_zone); + if (present_zone) list.add(zone); + + boolean present_name = true && (isSetName()); + list.add(present_name); + if (present_name) list.add(name); + + return list.hashCode(); + } + + @Override + public int compareTo(sayHello_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetZone()).compareTo(other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("sayHello_args("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_argsStandardSchemeFactory implements SchemeFactory { + public sayHello_argsStandardScheme getScheme() { + return new sayHello_argsStandardScheme(); + } + } + + private static class sayHello_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_argsTupleSchemeFactory implements SchemeFactory { + public sayHello_argsTupleScheme getScheme() { + return new sayHello_argsTupleScheme(); + } + } + + private static class sayHello_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetZone()) { + optionals.set(0); + } + if (struct.isSetName()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetZone()) { + oprot.writeString(struct.zone); + } + if (struct.isSetName()) { + oprot.writeString(struct.name); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } + if (incoming.get(1)) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } + } + } + } + + public static class sayHello_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new sayHello_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new sayHello_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_result.class, metaDataMap); + } + + public sayHello_result() {} + + public sayHello_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public sayHello_result(sayHello_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public sayHello_result deepCopy() { + return new sayHello_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public sayHello_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof sayHello_result) return this.equals((sayHello_result) that); + return false; + } + + public boolean equals(sayHello_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(sayHello_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("sayHello_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_resultStandardSchemeFactory implements SchemeFactory { + public sayHello_resultStandardScheme getScheme() { + return new sayHello_resultStandardScheme(); + } + } + + private static class sayHello_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_resultTupleSchemeFactory implements SchemeFactory { + public sayHello_resultTupleScheme getScheme() { + return new sayHello_resultTupleScheme(); + } + } + + private static class sayHello_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withDelay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withDelay_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withDelay_argsTupleSchemeFactory()); + } + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_args.class, metaDataMap); + } + + public withDelay_args() {} + + public withDelay_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public withDelay_args(withDelay_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public withDelay_args deepCopy() { + return new withDelay_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public withDelay_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return Integer.valueOf(getDelay()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withDelay_args) return this.equals((withDelay_args) that); + return false; + } + + public boolean equals(withDelay_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_delay = true; + list.add(present_delay); + if (present_delay) list.add(delay); + + return list.hashCode(); + } + + @Override + public int compareTo(withDelay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withDelay_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_argsStandardSchemeFactory implements SchemeFactory { + public withDelay_argsStandardScheme getScheme() { + return new withDelay_argsStandardScheme(); + } + } + + private static class withDelay_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_argsTupleSchemeFactory implements SchemeFactory { + public withDelay_argsTupleScheme getScheme() { + return new withDelay_argsTupleScheme(); + } + } + + private static class withDelay_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + } + + public static class withDelay_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withDelay_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withDelay_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_result.class, metaDataMap); + } + + public withDelay_result() {} + + public withDelay_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withDelay_result(withDelay_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withDelay_result deepCopy() { + return new withDelay_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withDelay_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withDelay_result) return this.equals((withDelay_result) that); + return false; + } + + public boolean equals(withDelay_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(withDelay_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withDelay_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_resultStandardSchemeFactory implements SchemeFactory { + public withDelay_resultStandardScheme getScheme() { + return new withDelay_resultStandardScheme(); + } + } + + private static class withDelay_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_resultTupleSchemeFactory implements SchemeFactory { + public withDelay_resultTupleScheme getScheme() { + return new withDelay_resultTupleScheme(); + } + } + + private static class withDelay_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withoutArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withoutArgs_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withoutArgs_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_args.class, metaDataMap); + } + + public withoutArgs_args() {} + + /** Performs a deep copy on other. */ + public withoutArgs_args(withoutArgs_args other) {} + + public withoutArgs_args deepCopy() { + return new withoutArgs_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withoutArgs_args) return this.equals((withoutArgs_args) that); + return false; + } + + public boolean equals(withoutArgs_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + return list.hashCode(); + } + + @Override + public int compareTo(withoutArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withoutArgs_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_argsStandardSchemeFactory implements SchemeFactory { + public withoutArgs_argsStandardScheme getScheme() { + return new withoutArgs_argsStandardScheme(); + } + } + + private static class withoutArgs_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_argsTupleSchemeFactory implements SchemeFactory { + public withoutArgs_argsTupleScheme getScheme() { + return new withoutArgs_argsTupleScheme(); + } + } + + private static class withoutArgs_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class withoutArgs_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withoutArgs_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withoutArgs_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_result.class, metaDataMap); + } + + public withoutArgs_result() {} + + public withoutArgs_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withoutArgs_result(withoutArgs_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withoutArgs_result deepCopy() { + return new withoutArgs_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withoutArgs_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withoutArgs_result) return this.equals((withoutArgs_result) that); + return false; + } + + public boolean equals(withoutArgs_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(withoutArgs_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withoutArgs_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_resultStandardSchemeFactory implements SchemeFactory { + public withoutArgs_resultStandardScheme getScheme() { + return new withoutArgs_resultStandardScheme(); + } + } + + private static class withoutArgs_resultStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_resultTupleSchemeFactory implements SchemeFactory { + public withoutArgs_resultTupleScheme getScheme() { + return new withoutArgs_resultTupleScheme(); + } + } + + private static class withoutArgs_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withError_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withError_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_args.class, metaDataMap); + } + + public withError_args() {} + + /** Performs a deep copy on other. */ + public withError_args(withError_args other) {} + + public withError_args deepCopy() { + return new withError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withError_args) return this.equals((withError_args) that); + return false; + } + + public boolean equals(withError_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + return list.hashCode(); + } + + @Override + public int compareTo(withError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_argsStandardSchemeFactory implements SchemeFactory { + public withError_argsStandardScheme getScheme() { + return new withError_argsStandardScheme(); + } + } + + private static class withError_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_argsTupleSchemeFactory implements SchemeFactory { + public withError_argsTupleScheme getScheme() { + return new withError_argsTupleScheme(); + } + } + + private static class withError_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class withError_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withError_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withError_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_result.class, metaDataMap); + } + + public withError_result() {} + + public withError_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withError_result(withError_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withError_result deepCopy() { + return new withError_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withError_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withError_result) return this.equals((withError_result) that); + return false; + } + + public boolean equals(withError_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(withError_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withError_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_resultStandardSchemeFactory implements SchemeFactory { + public withError_resultStandardScheme getScheme() { + return new withError_resultStandardScheme(); + } + } + + private static class withError_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_resultTupleSchemeFactory implements SchemeFactory { + public withError_resultTupleScheme getScheme() { + return new withError_resultTupleScheme(); + } + } + + private static class withError_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withCollisioin_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_args"); + + private static final org.apache.thrift.protocol.TField INPUT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "input", org.apache.thrift.protocol.TType.STRING, (short) 3333); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withCollisioin_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withCollisioin_argsTupleSchemeFactory()); + } + + public String input; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + INPUT((short) 3333, "input"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 3333: // INPUT + return INPUT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.INPUT, + new org.apache.thrift.meta_data.FieldMetaData( + "input", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_args.class, metaDataMap); + } + + public withCollisioin_args() {} + + public withCollisioin_args(String input) { + this(); + this.input = input; + } + + /** Performs a deep copy on other. */ + public withCollisioin_args(withCollisioin_args other) { + if (other.isSetInput()) { + this.input = other.input; + } + } + + public withCollisioin_args deepCopy() { + return new withCollisioin_args(this); + } + + @Override + public void clear() { + this.input = null; + } + + public String getInput() { + return this.input; + } + + public withCollisioin_args setInput(String input) { + this.input = input; + return this; + } + + public void unsetInput() { + this.input = null; + } + + /** Returns true if field input is set (has been assigned a value) and false otherwise */ + public boolean isSetInput() { + return this.input != null; + } + + public void setInputIsSet(boolean value) { + if (!value) { + this.input = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case INPUT: + if (value == null) { + unsetInput(); + } else { + setInput((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case INPUT: + return getInput(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case INPUT: + return isSetInput(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withCollisioin_args) return this.equals((withCollisioin_args) that); + return false; + } + + public boolean equals(withCollisioin_args that) { + if (that == null) return false; + + boolean this_present_input = true && this.isSetInput(); + boolean that_present_input = true && that.isSetInput(); + if (this_present_input || that_present_input) { + if (!(this_present_input && that_present_input)) return false; + if (!this.input.equals(that.input)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_input = true && (isSetInput()); + list.add(present_input); + if (present_input) list.add(input); + + return list.hashCode(); + } + + @Override + public int compareTo(withCollisioin_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetInput()).compareTo(other.isSetInput()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInput()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.input, other.input); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withCollisioin_args("); + boolean first = true; + + sb.append("input:"); + if (this.input == null) { + sb.append("null"); + } else { + sb.append(this.input); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_argsStandardSchemeFactory implements SchemeFactory { + public withCollisioin_argsStandardScheme getScheme() { + return new withCollisioin_argsStandardScheme(); + } + } + + private static class withCollisioin_argsStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 3333: // INPUT + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.input != null) { + oprot.writeFieldBegin(INPUT_FIELD_DESC); + oprot.writeString(struct.input); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_argsTupleSchemeFactory implements SchemeFactory { + public withCollisioin_argsTupleScheme getScheme() { + return new withCollisioin_argsTupleScheme(); + } + } + + private static class withCollisioin_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetInput()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetInput()) { + oprot.writeString(struct.input); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } + } + } + } + + public static class withCollisioin_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withCollisioin_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withCollisioin_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_result.class, metaDataMap); + } + + public withCollisioin_result() {} + + public withCollisioin_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withCollisioin_result(withCollisioin_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withCollisioin_result deepCopy() { + return new withCollisioin_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withCollisioin_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withCollisioin_result) return this.equals((withCollisioin_result) that); + return false; + } + + public boolean equals(withCollisioin_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(withCollisioin_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withCollisioin_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_resultStandardSchemeFactory implements SchemeFactory { + public withCollisioin_resultStandardScheme getScheme() { + return new withCollisioin_resultStandardScheme(); + } + } + + private static class withCollisioin_resultStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_resultTupleSchemeFactory implements SchemeFactory { + public withCollisioin_resultTupleScheme getScheme() { + return new withCollisioin_resultTupleScheme(); + } + } + + private static class withCollisioin_resultTupleScheme + extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class noReturn_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new noReturn_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new noReturn_argsTupleSchemeFactory()); + } + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_args.class, metaDataMap); + } + + public noReturn_args() {} + + public noReturn_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public noReturn_args(noReturn_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public noReturn_args deepCopy() { + return new noReturn_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public noReturn_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return Integer.valueOf(getDelay()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof noReturn_args) return this.equals((noReturn_args) that); + return false; + } + + public boolean equals(noReturn_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_delay = true; + list.add(present_delay); + if (present_delay) list.add(delay); + + return list.hashCode(); + } + + @Override + public int compareTo(noReturn_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("noReturn_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_argsStandardSchemeFactory implements SchemeFactory { + public noReturn_argsStandardScheme getScheme() { + return new noReturn_argsStandardScheme(); + } + } + + private static class noReturn_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_argsTupleSchemeFactory implements SchemeFactory { + public noReturn_argsTupleScheme getScheme() { + return new noReturn_argsTupleScheme(); + } + } + + private static class noReturn_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + } + + public static class noReturn_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_result"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new noReturn_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new noReturn_resultTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_result.class, metaDataMap); + } + + public noReturn_result() {} + + /** Performs a deep copy on other. */ + public noReturn_result(noReturn_result other) {} + + public noReturn_result deepCopy() { + return new noReturn_result(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof noReturn_result) return this.equals((noReturn_result) that); + return false; + } + + public boolean equals(noReturn_result that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + return list.hashCode(); + } + + @Override + public int compareTo(noReturn_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("noReturn_result("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_resultStandardSchemeFactory implements SchemeFactory { + public noReturn_resultStandardScheme getScheme() { + return new noReturn_resultStandardScheme(); + } + } + + private static class noReturn_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_resultTupleSchemeFactory implements SchemeFactory { + public noReturn_resultTupleScheme getScheme() { + return new noReturn_resultTupleScheme(); + } + } + + private static class noReturn_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class oneWayHasArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayHasArgs_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new oneWayHasArgs_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new oneWayHasArgs_argsTupleSchemeFactory()); + } + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayHasArgs_args.class, metaDataMap); + } + + public oneWayHasArgs_args() {} + + public oneWayHasArgs_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public oneWayHasArgs_args(oneWayHasArgs_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public oneWayHasArgs_args deepCopy() { + return new oneWayHasArgs_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public oneWayHasArgs_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return Integer.valueOf(getDelay()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWayHasArgs_args) return this.equals((oneWayHasArgs_args) that); + return false; + } + + public boolean equals(oneWayHasArgs_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_delay = true; + list.add(present_delay); + if (present_delay) list.add(delay); + + return list.hashCode(); + } + + @Override + public int compareTo(oneWayHasArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWayHasArgs_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayHasArgs_argsStandardSchemeFactory implements SchemeFactory { + public oneWayHasArgs_argsStandardScheme getScheme() { + return new oneWayHasArgs_argsStandardScheme(); + } + } + + private static class oneWayHasArgs_argsStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayHasArgs_argsTupleSchemeFactory implements SchemeFactory { + public oneWayHasArgs_argsTupleScheme getScheme() { + return new oneWayHasArgs_argsTupleScheme(); + } + } + + private static class oneWayHasArgs_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + } + + public static class oneWay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWay_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new oneWay_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new oneWay_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWay_args.class, metaDataMap); + } + + public oneWay_args() {} + + /** Performs a deep copy on other. */ + public oneWay_args(oneWay_args other) {} + + public oneWay_args deepCopy() { + return new oneWay_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWay_args) return this.equals((oneWay_args) that); + return false; + } + + public boolean equals(oneWay_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + return list.hashCode(); + } + + @Override + public int compareTo(oneWay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWay_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWay_argsStandardSchemeFactory implements SchemeFactory { + public oneWay_argsStandardScheme getScheme() { + return new oneWay_argsStandardScheme(); + } + } + + private static class oneWay_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWay_argsTupleSchemeFactory implements SchemeFactory { + public oneWay_argsTupleScheme getScheme() { + return new oneWay_argsTupleScheme(); + } + } + + private static class oneWay_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class oneWayWithError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayWithError_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new oneWayWithError_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new oneWayWithError_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayWithError_args.class, metaDataMap); + } + + public oneWayWithError_args() {} + + /** Performs a deep copy on other. */ + public oneWayWithError_args(oneWayWithError_args other) {} + + public oneWayWithError_args deepCopy() { + return new oneWayWithError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWayWithError_args) return this.equals((oneWayWithError_args) that); + return false; + } + + public boolean equals(oneWayWithError_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + return list.hashCode(); + } + + @Override + public int compareTo(oneWayWithError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWayWithError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayWithError_argsStandardSchemeFactory implements SchemeFactory { + public oneWayWithError_argsStandardScheme getScheme() { + return new oneWayWithError_argsStandardScheme(); + } + } + + private static class oneWayWithError_argsStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayWithError_argsTupleSchemeFactory implements SchemeFactory { + public oneWayWithError_argsTupleScheme getScheme() { + return new oneWayWithError_argsTupleScheme(); + } + } + + private static class oneWayWithError_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class data_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_args"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new data_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new data_argsTupleSchemeFactory()); + } + + public User user; // required + public Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(data_args.class, metaDataMap); + } + + public data_args() {} + + public data_args(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public data_args(data_args other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public data_args deepCopy() { + return new data_args(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + public User getUser() { + return this.user; + } + + public data_args setUser(User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + public Account getAccount() { + return this.account; + } + + public data_args setAccount(Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof data_args) return this.equals((data_args) that); + return false; + } + + public boolean equals(data_args that) { + if (that == null) return false; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_user = true && (isSetUser()); + list.add(present_user); + if (present_user) list.add(user); + + boolean present_account = true && (isSetAccount()); + list.add(present_account); + if (present_account) list.add(account); + + return list.hashCode(); + } + + @Override + public int compareTo(data_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetUser()).compareTo(other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAccount()).compareTo(other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("data_args("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_argsStandardSchemeFactory implements SchemeFactory { + public data_argsStandardScheme getScheme() { + return new data_argsStandardScheme(); + } + } + + private static class data_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_argsTupleSchemeFactory implements SchemeFactory { + public data_argsTupleScheme getScheme() { + return new data_argsTupleScheme(); + } + } + + private static class data_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetUser()) { + optionals.set(0); + } + if (struct.isSetAccount()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetUser()) { + struct.user.write(oprot); + } + if (struct.isSetAccount()) { + struct.account.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } + if (incoming.get(1)) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + } + } + + public static class data_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRUCT, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new data_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new data_resultTupleSchemeFactory()); + } + + public UserAccount success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, UserAccount.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + data_result.class, metaDataMap); + } + + public data_result() {} + + public data_result(UserAccount success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public data_result(data_result other) { + if (other.isSetSuccess()) { + this.success = new UserAccount(other.success); + } + } + + public data_result deepCopy() { + return new data_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public UserAccount getSuccess() { + return this.success; + } + + public data_result setSuccess(UserAccount success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((UserAccount) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof data_result) return this.equals((data_result) that); + return false; + } + + public boolean equals(data_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(data_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("data_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_resultStandardSchemeFactory implements SchemeFactory { + public data_resultStandardScheme getScheme() { + return new data_resultStandardScheme(); + } + } + + private static class data_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_resultTupleSchemeFactory implements SchemeFactory { + public data_resultTupleScheme getScheme() { + return new data_resultTupleScheme(); + } + } + + private static class data_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_2/User.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_2/User.java new file mode 100644 index 000000000000..63e09fa718e3 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_2/User.java @@ -0,0 +1,598 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_9_2; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.server.AbstractNonblockingServer.*; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2025-2-27") +public class User + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("User"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "userId", org.apache.thrift.protocol.TType.STRING, (short) 2); + private static final org.apache.thrift.protocol.TField AGE_FIELD_DESC = + new org.apache.thrift.protocol.TField("age", org.apache.thrift.protocol.TType.I32, (short) 3); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new UserStandardSchemeFactory()); + schemes.put(TupleScheme.class, new UserTupleSchemeFactory()); + } + + public String name; // required + public String userId; // required + public int age; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + NAME((short) 1, "name"), + USER_ID((short) 2, "userId"), + AGE((short) 3, "age"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // NAME + return NAME; + case 2: // USER_ID + return USER_ID; + case 3: // AGE + return AGE; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __AGE_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.USER_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "userId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.AGE, + new org.apache.thrift.meta_data.FieldMetaData( + "age", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(User.class, metaDataMap); + } + + public User() {} + + public User(String name, String userId, int age) { + this(); + this.name = name; + this.userId = userId; + this.age = age; + setAgeIsSet(true); + } + + /** Performs a deep copy on other. */ + public User(User other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetName()) { + this.name = other.name; + } + if (other.isSetUserId()) { + this.userId = other.userId; + } + this.age = other.age; + } + + public User deepCopy() { + return new User(this); + } + + @Override + public void clear() { + this.name = null; + this.userId = null; + setAgeIsSet(false); + this.age = 0; + } + + public String getName() { + return this.name; + } + + public User setName(String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public String getUserId() { + return this.userId; + } + + public User setUserId(String userId) { + this.userId = userId; + return this; + } + + public void unsetUserId() { + this.userId = null; + } + + /** Returns true if field userId is set (has been assigned a value) and false otherwise */ + public boolean isSetUserId() { + return this.userId != null; + } + + public void setUserIdIsSet(boolean value) { + if (!value) { + this.userId = null; + } + } + + public int getAge() { + return this.age; + } + + public User setAge(int age) { + this.age = age; + setAgeIsSet(true); + return this; + } + + public void unsetAge() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __AGE_ISSET_ID); + } + + /** Returns true if field age is set (has been assigned a value) and false otherwise */ + public boolean isSetAge() { + return EncodingUtils.testBit(__isset_bitfield, __AGE_ISSET_ID); + } + + public void setAgeIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __AGE_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case NAME: + if (value == null) { + unsetName(); + } else { + setName((String) value); + } + break; + + case USER_ID: + if (value == null) { + unsetUserId(); + } else { + setUserId((String) value); + } + break; + + case AGE: + if (value == null) { + unsetAge(); + } else { + setAge((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case NAME: + return getName(); + + case USER_ID: + return getUserId(); + + case AGE: + return Integer.valueOf(getAge()); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case NAME: + return isSetName(); + case USER_ID: + return isSetUserId(); + case AGE: + return isSetAge(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof User) return this.equals((User) that); + return false; + } + + public boolean equals(User that) { + if (that == null) return false; + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + boolean this_present_userId = true && this.isSetUserId(); + boolean that_present_userId = true && that.isSetUserId(); + if (this_present_userId || that_present_userId) { + if (!(this_present_userId && that_present_userId)) return false; + if (!this.userId.equals(that.userId)) return false; + } + + boolean this_present_age = true; + boolean that_present_age = true; + if (this_present_age || that_present_age) { + if (!(this_present_age && that_present_age)) return false; + if (this.age != that.age) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_name = true && (isSetName()); + list.add(present_name); + if (present_name) list.add(name); + + boolean present_userId = true && (isSetUserId()); + list.add(present_userId); + if (present_userId) list.add(userId); + + boolean present_age = true; + list.add(present_age); + if (present_age) list.add(age); + + return list.hashCode(); + } + + @Override + public int compareTo(User other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetUserId()).compareTo(other.isSetUserId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAge()).compareTo(other.isSetAge()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAge()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.age, other.age); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("User("); + boolean first = true; + + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + if (!first) sb.append(", "); + sb.append("userId:"); + if (this.userId == null) { + sb.append("null"); + } else { + sb.append(this.userId); + } + first = false; + if (!first) sb.append(", "); + sb.append("age:"); + sb.append(this.age); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (name == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'name' was not present! Struct: " + toString()); + } + if (userId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'userId' was not present! Struct: " + toString()); + } + // alas, we cannot check 'age' because it's a primitive and you chose the non-beans generator. + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserStandardSchemeFactory implements SchemeFactory { + public UserStandardScheme getScheme() { + return new UserStandardScheme(); + } + } + + private static class UserStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // AGE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + if (!struct.isSetAge()) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'age' was not found in serialized data! Struct: " + toString()); + } + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, User struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + if (struct.userId != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userId); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(AGE_FIELD_DESC); + oprot.writeI32(struct.age); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserTupleSchemeFactory implements SchemeFactory { + public UserTupleScheme getScheme() { + return new UserTupleScheme(); + } + } + + private static class UserTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeString(struct.name); + oprot.writeString(struct.userId); + oprot.writeI32(struct.age); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.name = iprot.readString(); + struct.setNameIsSet(true); + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_2/UserAccount.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_2/UserAccount.java new file mode 100644 index 000000000000..2cd7e87704d6 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_2/UserAccount.java @@ -0,0 +1,503 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_9_2; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.server.AbstractNonblockingServer.*; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2025-2-27") +public class UserAccount + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("UserAccount"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new UserAccountStandardSchemeFactory()); + schemes.put(TupleScheme.class, new UserAccountTupleSchemeFactory()); + } + + public User user; // required + public Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserAccount.class, metaDataMap); + } + + public UserAccount() {} + + public UserAccount(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public UserAccount(UserAccount other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public UserAccount deepCopy() { + return new UserAccount(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + public User getUser() { + return this.user; + } + + public UserAccount setUser(User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + public Account getAccount() { + return this.account; + } + + public UserAccount setAccount(Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof UserAccount) return this.equals((UserAccount) that); + return false; + } + + public boolean equals(UserAccount that) { + if (that == null) return false; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_user = true && (isSetUser()); + list.add(present_user); + if (present_user) list.add(user); + + boolean present_account = true && (isSetAccount()); + list.add(present_account); + if (present_account) list.add(account); + + return list.hashCode(); + } + + @Override + public int compareTo(UserAccount other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetUser()).compareTo(other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAccount()).compareTo(other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("UserAccount("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (user == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'user' was not present! Struct: " + toString()); + } + if (account == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'account' was not present! Struct: " + toString()); + } + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserAccountStandardSchemeFactory implements SchemeFactory { + public UserAccountStandardScheme getScheme() { + return new UserAccountStandardScheme(); + } + } + + private static class UserAccountStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, UserAccount struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserAccountTupleSchemeFactory implements SchemeFactory { + public UserAccountTupleScheme getScheme() { + return new UserAccountTupleScheme(); + } + } + + private static class UserAccountTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + struct.user.write(oprot); + struct.account.write(oprot); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_3/Account.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_3/Account.java new file mode 100644 index 000000000000..fe32410ab1a6 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_3/Account.java @@ -0,0 +1,493 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_9_3; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.server.AbstractNonblockingServer.*; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2025-02-27") +public class Account + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("Account"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField CARD_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "cardId", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new AccountStandardSchemeFactory()); + schemes.put(TupleScheme.class, new AccountTupleSchemeFactory()); + } + + public String zone; // required + public String cardId; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + CARD_ID((short) 2, "cardId"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // CARD_ID + return CARD_ID; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.CARD_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "cardId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Account.class, metaDataMap); + } + + public Account() {} + + public Account(String zone, String cardId) { + this(); + this.zone = zone; + this.cardId = cardId; + } + + /** Performs a deep copy on other. */ + public Account(Account other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetCardId()) { + this.cardId = other.cardId; + } + } + + public Account deepCopy() { + return new Account(this); + } + + @Override + public void clear() { + this.zone = null; + this.cardId = null; + } + + public String getZone() { + return this.zone; + } + + public Account setZone(String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + public String getCardId() { + return this.cardId; + } + + public Account setCardId(String cardId) { + this.cardId = cardId; + return this; + } + + public void unsetCardId() { + this.cardId = null; + } + + /** Returns true if field cardId is set (has been assigned a value) and false otherwise */ + public boolean isSetCardId() { + return this.cardId != null; + } + + public void setCardIdIsSet(boolean value) { + if (!value) { + this.cardId = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((String) value); + } + break; + + case CARD_ID: + if (value == null) { + unsetCardId(); + } else { + setCardId((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case CARD_ID: + return getCardId(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case CARD_ID: + return isSetCardId(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof Account) return this.equals((Account) that); + return false; + } + + public boolean equals(Account that) { + if (that == null) return false; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_cardId = true && this.isSetCardId(); + boolean that_present_cardId = true && that.isSetCardId(); + if (this_present_cardId || that_present_cardId) { + if (!(this_present_cardId && that_present_cardId)) return false; + if (!this.cardId.equals(that.cardId)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_zone = true && (isSetZone()); + list.add(present_zone); + if (present_zone) list.add(zone); + + boolean present_cardId = true && (isSetCardId()); + list.add(present_cardId); + if (present_cardId) list.add(cardId); + + return list.hashCode(); + } + + @Override + public int compareTo(Account other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetZone()).compareTo(other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetCardId()).compareTo(other.isSetCardId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCardId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cardId, other.cardId); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("Account("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("cardId:"); + if (this.cardId == null) { + sb.append("null"); + } else { + sb.append(this.cardId); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (zone == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'zone' was not present! Struct: " + toString()); + } + if (cardId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'cardId' was not present! Struct: " + toString()); + } + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class AccountStandardSchemeFactory implements SchemeFactory { + public AccountStandardScheme getScheme() { + return new AccountStandardScheme(); + } + } + + private static class AccountStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, Account struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // CARD_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, Account struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.cardId != null) { + oprot.writeFieldBegin(CARD_ID_FIELD_DESC); + oprot.writeString(struct.cardId); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class AccountTupleSchemeFactory implements SchemeFactory { + public AccountTupleScheme getScheme() { + return new AccountTupleScheme(); + } + } + + private static class AccountTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeString(struct.zone); + oprot.writeString(struct.cardId); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, Account struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + struct.cardId = iprot.readString(); + struct.setCardIdIsSet(true); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_3/ThriftService.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_3/ThriftService.java new file mode 100644 index 000000000000..f4ad11f9c04f --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_3/ThriftService.java @@ -0,0 +1,7635 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_9_3; + +import java.util.ArrayList; +import java.util.BitSet; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.server.AbstractNonblockingServer.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2025-02-27") +public class ThriftService { + + public interface Iface { + + public String sayHello(String zone, String name) throws org.apache.thrift.TException; + + public String withDelay(int delay) throws org.apache.thrift.TException; + + public String withoutArgs() throws org.apache.thrift.TException; + + public String withError() throws org.apache.thrift.TException; + + public String withCollisioin(String input) throws org.apache.thrift.TException; + + public void noReturn(int delay) throws org.apache.thrift.TException; + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException; + + public void oneWay() throws org.apache.thrift.TException; + + public void oneWayWithError() throws org.apache.thrift.TException; + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException; + } + + public interface AsyncIface { + + public void sayHello( + String zone, String name, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withDelay(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withoutArgs(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void withCollisioin( + String input, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayHasArgs(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + + public void data( + User user, Account account, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException; + } + + public static class Client extends org.apache.thrift.TServiceClient implements Iface { + public static class Factory implements org.apache.thrift.TServiceClientFactory { + public Factory() {} + + public Client getClient(org.apache.thrift.protocol.TProtocol prot) { + return new Client(prot); + } + + public Client getClient( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + return new Client(iprot, oprot); + } + } + + public Client(org.apache.thrift.protocol.TProtocol prot) { + super(prot, prot); + } + + public Client( + org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) { + super(iprot, oprot); + } + + public String sayHello(String zone, String name) throws org.apache.thrift.TException { + send_sayHello(zone, name); + return recv_sayHello(); + } + + public void send_sayHello(String zone, String name) throws org.apache.thrift.TException { + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + sendBase("sayHello", args); + } + + public String recv_sayHello() throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + receiveBase(result, "sayHello"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "sayHello failed: unknown result"); + } + + public String withDelay(int delay) throws org.apache.thrift.TException { + send_withDelay(delay); + return recv_withDelay(); + } + + public void send_withDelay(int delay) throws org.apache.thrift.TException { + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + sendBase("withDelay", args); + } + + public String recv_withDelay() throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + receiveBase(result, "withDelay"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withDelay failed: unknown result"); + } + + public String withoutArgs() throws org.apache.thrift.TException { + send_withoutArgs(); + return recv_withoutArgs(); + } + + public void send_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_args args = new withoutArgs_args(); + sendBase("withoutArgs", args); + } + + public String recv_withoutArgs() throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + receiveBase(result, "withoutArgs"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withoutArgs failed: unknown result"); + } + + public String withError() throws org.apache.thrift.TException { + send_withError(); + return recv_withError(); + } + + public void send_withError() throws org.apache.thrift.TException { + withError_args args = new withError_args(); + sendBase("withError", args); + } + + public String recv_withError() throws org.apache.thrift.TException { + withError_result result = new withError_result(); + receiveBase(result, "withError"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withError failed: unknown result"); + } + + public String withCollisioin(String input) throws org.apache.thrift.TException { + send_withCollisioin(input); + return recv_withCollisioin(); + } + + public void send_withCollisioin(String input) throws org.apache.thrift.TException { + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + sendBase("withCollisioin", args); + } + + public String recv_withCollisioin() throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + receiveBase(result, "withCollisioin"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, + "withCollisioin failed: unknown result"); + } + + public void noReturn(int delay) throws org.apache.thrift.TException { + send_noReturn(delay); + recv_noReturn(); + } + + public void send_noReturn(int delay) throws org.apache.thrift.TException { + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + sendBase("noReturn", args); + } + + public void recv_noReturn() throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + receiveBase(result, "noReturn"); + return; + } + + public void oneWayHasArgs(int delay) throws org.apache.thrift.TException { + send_oneWayHasArgs(delay); + } + + public void send_oneWayHasArgs(int delay) throws org.apache.thrift.TException { + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + sendBaseOneway("oneWayHasArgs", args); + } + + public void oneWay() throws org.apache.thrift.TException { + send_oneWay(); + } + + public void send_oneWay() throws org.apache.thrift.TException { + oneWay_args args = new oneWay_args(); + sendBaseOneway("oneWay", args); + } + + public void oneWayWithError() throws org.apache.thrift.TException { + send_oneWayWithError(); + } + + public void send_oneWayWithError() throws org.apache.thrift.TException { + oneWayWithError_args args = new oneWayWithError_args(); + sendBaseOneway("oneWayWithError", args); + } + + public UserAccount data(User user, Account account) throws org.apache.thrift.TException { + send_data(user, account); + return recv_data(); + } + + public void send_data(User user, Account account) throws org.apache.thrift.TException { + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + sendBase("data", args); + } + + public UserAccount recv_data() throws org.apache.thrift.TException { + data_result result = new data_result(); + receiveBase(result, "data"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.MISSING_RESULT, "data failed: unknown result"); + } + } + + public static class AsyncClient extends org.apache.thrift.async.TAsyncClient + implements AsyncIface { + public static class Factory + implements org.apache.thrift.async.TAsyncClientFactory { + private org.apache.thrift.async.TAsyncClientManager clientManager; + private org.apache.thrift.protocol.TProtocolFactory protocolFactory; + + public Factory( + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.protocol.TProtocolFactory protocolFactory) { + this.clientManager = clientManager; + this.protocolFactory = protocolFactory; + } + + public AsyncClient getAsyncClient( + org.apache.thrift.transport.TNonblockingTransport transport) { + return new AsyncClient(protocolFactory, clientManager, transport); + } + } + + public AsyncClient( + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.async.TAsyncClientManager clientManager, + org.apache.thrift.transport.TNonblockingTransport transport) { + super(protocolFactory, clientManager, transport); + } + + public void sayHello( + String zone, String name, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + sayHello_call method_call = + new sayHello_call(zone, name, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class sayHello_call extends org.apache.thrift.async.TAsyncMethodCall { + private String zone; + private String name; + + public sayHello_call( + String zone, + String name, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.zone = zone; + this.name = name; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "sayHello", org.apache.thrift.protocol.TMessageType.CALL, 0)); + sayHello_args args = new sayHello_args(); + args.setZone(zone); + args.setName(name); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_sayHello(); + } + } + + public void withDelay(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withDelay_call method_call = + new withDelay_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withDelay_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public withDelay_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withDelay", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withDelay_args args = new withDelay_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withDelay(); + } + } + + public void withoutArgs(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withoutArgs_call method_call = + new withoutArgs_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withoutArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + public withoutArgs_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withoutArgs", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withoutArgs_args args = new withoutArgs_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withoutArgs(); + } + } + + public void withError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withError_call method_call = + new withError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withError_call extends org.apache.thrift.async.TAsyncMethodCall { + public withError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withError", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withError_args args = new withError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withError(); + } + } + + public void withCollisioin( + String input, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + withCollisioin_call method_call = + new withCollisioin_call(input, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class withCollisioin_call extends org.apache.thrift.async.TAsyncMethodCall { + private String input; + + public withCollisioin_call( + String input, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.input = input; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "withCollisioin", org.apache.thrift.protocol.TMessageType.CALL, 0)); + withCollisioin_args args = new withCollisioin_args(); + args.setInput(input); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_withCollisioin(); + } + } + + public void noReturn(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + noReturn_call method_call = + new noReturn_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class noReturn_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public noReturn_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "noReturn", org.apache.thrift.protocol.TMessageType.CALL, 0)); + noReturn_args args = new noReturn_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + (new Client(prot)).recv_noReturn(); + } + } + + public void oneWayHasArgs(int delay, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayHasArgs_call method_call = + new oneWayHasArgs_call(delay, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayHasArgs_call extends org.apache.thrift.async.TAsyncMethodCall { + private int delay; + + public oneWayHasArgs_call( + int delay, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + this.delay = delay; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayHasArgs", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayHasArgs_args args = new oneWayHasArgs_args(); + args.setDelay(delay); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void oneWay(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWay_call method_call = + new oneWay_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWay_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWay_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWay", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWay_args args = new oneWay_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void oneWayWithError(org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + oneWayWithError_call method_call = + new oneWayWithError_call(resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class oneWayWithError_call extends org.apache.thrift.async.TAsyncMethodCall { + public oneWayWithError_call( + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, true); + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "oneWayWithError", org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); + oneWayWithError_args args = new oneWayWithError_args(); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + } + } + + public void data( + User user, Account account, org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws org.apache.thrift.TException { + checkReady(); + data_call method_call = + new data_call(user, account, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class data_call extends org.apache.thrift.async.TAsyncMethodCall { + private User user; + private Account account; + + public data_call( + User user, + Account account, + org.apache.thrift.async.AsyncMethodCallback resultHandler, + org.apache.thrift.async.TAsyncClient client, + org.apache.thrift.protocol.TProtocolFactory protocolFactory, + org.apache.thrift.transport.TNonblockingTransport transport) + throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.user = user; + this.account = account; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) + throws org.apache.thrift.TException { + prot.writeMessageBegin( + new org.apache.thrift.protocol.TMessage( + "data", org.apache.thrift.protocol.TMessageType.CALL, 0)); + data_args args = new data_args(); + args.setUser(user); + args.setAccount(account); + args.write(prot); + prot.writeMessageEnd(); + } + + public UserAccount getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = + new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = + client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_data(); + } + } + } + + public static class Processor extends org.apache.thrift.TBaseProcessor + implements org.apache.thrift.TProcessor { + private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName()); + + public Processor(I iface) { + super( + iface, + getProcessMap( + new HashMap< + String, + org.apache.thrift.ProcessFunction>())); + } + + protected Processor( + I iface, + Map> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + Map> + getProcessMap( + Map> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.ProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + protected boolean isOneway() { + return false; + } + + public sayHello_result getResult(I iface, sayHello_args args) + throws org.apache.thrift.TException { + sayHello_result result = new sayHello_result(); + result.success = iface.sayHello(args.zone, args.name); + return result; + } + } + + public static class withDelay + extends org.apache.thrift.ProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + protected boolean isOneway() { + return false; + } + + public withDelay_result getResult(I iface, withDelay_args args) + throws org.apache.thrift.TException { + withDelay_result result = new withDelay_result(); + result.success = iface.withDelay(args.delay); + return result; + } + } + + public static class withoutArgs + extends org.apache.thrift.ProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + protected boolean isOneway() { + return false; + } + + public withoutArgs_result getResult(I iface, withoutArgs_args args) + throws org.apache.thrift.TException { + withoutArgs_result result = new withoutArgs_result(); + result.success = iface.withoutArgs(); + return result; + } + } + + public static class withError + extends org.apache.thrift.ProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + protected boolean isOneway() { + return false; + } + + public withError_result getResult(I iface, withError_args args) + throws org.apache.thrift.TException { + withError_result result = new withError_result(); + result.success = iface.withError(); + return result; + } + } + + public static class withCollisioin + extends org.apache.thrift.ProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + protected boolean isOneway() { + return false; + } + + public withCollisioin_result getResult(I iface, withCollisioin_args args) + throws org.apache.thrift.TException { + withCollisioin_result result = new withCollisioin_result(); + result.success = iface.withCollisioin(args.input); + return result; + } + } + + public static class noReturn + extends org.apache.thrift.ProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + protected boolean isOneway() { + return false; + } + + public noReturn_result getResult(I iface, noReturn_args args) + throws org.apache.thrift.TException { + noReturn_result result = new noReturn_result(); + iface.noReturn(args.delay); + return result; + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.ProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + protected boolean isOneway() { + return true; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayHasArgs_args args) + throws org.apache.thrift.TException { + iface.oneWayHasArgs(args.delay); + return null; + } + } + + public static class oneWay + extends org.apache.thrift.ProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + protected boolean isOneway() { + return true; + } + + public org.apache.thrift.TBase getResult(I iface, oneWay_args args) + throws org.apache.thrift.TException { + iface.oneWay(); + return null; + } + } + + public static class oneWayWithError + extends org.apache.thrift.ProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + protected boolean isOneway() { + return true; + } + + public org.apache.thrift.TBase getResult(I iface, oneWayWithError_args args) + throws org.apache.thrift.TException { + iface.oneWayWithError(); + return null; + } + } + + public static class data + extends org.apache.thrift.ProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + protected boolean isOneway() { + return false; + } + + public data_result getResult(I iface, data_args args) throws org.apache.thrift.TException { + data_result result = new data_result(); + result.success = iface.data(args.user, args.account); + return result; + } + } + } + + public static class AsyncProcessor + extends org.apache.thrift.TBaseAsyncProcessor { + private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName()); + + public AsyncProcessor(I iface) { + super( + iface, + getProcessMap( + new HashMap< + String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>>())); + } + + protected AsyncProcessor( + I iface, + Map> + processMap) { + super(iface, getProcessMap(processMap)); + } + + private static + Map> + getProcessMap( + Map< + String, + org.apache.thrift.AsyncProcessFunction< + I, ? extends org.apache.thrift.TBase, ?>> + processMap) { + processMap.put("sayHello", new sayHello()); + processMap.put("withDelay", new withDelay()); + processMap.put("withoutArgs", new withoutArgs()); + processMap.put("withError", new withError()); + processMap.put("withCollisioin", new withCollisioin()); + processMap.put("noReturn", new noReturn()); + processMap.put("oneWayHasArgs", new oneWayHasArgs()); + processMap.put("oneWay", new oneWay()); + processMap.put("oneWayWithError", new oneWayWithError()); + processMap.put("data", new data()); + return processMap; + } + + public static class sayHello + extends org.apache.thrift.AsyncProcessFunction { + public sayHello() { + super("sayHello"); + } + + public sayHello_args getEmptyArgsInstance() { + return new sayHello_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(String o) { + sayHello_result result = new sayHello_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + sayHello_result result = new sayHello_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + sayHello_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + iface.sayHello(args.zone, args.name, resultHandler); + } + } + + public static class withDelay + extends org.apache.thrift.AsyncProcessFunction { + public withDelay() { + super("withDelay"); + } + + public withDelay_args getEmptyArgsInstance() { + return new withDelay_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(String o) { + withDelay_result result = new withDelay_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + withDelay_result result = new withDelay_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withDelay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + iface.withDelay(args.delay, resultHandler); + } + } + + public static class withoutArgs + extends org.apache.thrift.AsyncProcessFunction { + public withoutArgs() { + super("withoutArgs"); + } + + public withoutArgs_args getEmptyArgsInstance() { + return new withoutArgs_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(String o) { + withoutArgs_result result = new withoutArgs_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + withoutArgs_result result = new withoutArgs_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withoutArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + iface.withoutArgs(resultHandler); + } + } + + public static class withError + extends org.apache.thrift.AsyncProcessFunction { + public withError() { + super("withError"); + } + + public withError_args getEmptyArgsInstance() { + return new withError_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(String o) { + withError_result result = new withError_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + withError_result result = new withError_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + iface.withError(resultHandler); + } + } + + public static class withCollisioin + extends org.apache.thrift.AsyncProcessFunction { + public withCollisioin() { + super("withCollisioin"); + } + + public withCollisioin_args getEmptyArgsInstance() { + return new withCollisioin_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(String o) { + withCollisioin_result result = new withCollisioin_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + withCollisioin_result result = new withCollisioin_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + withCollisioin_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + iface.withCollisioin(args.input, resultHandler); + } + } + + public static class noReturn + extends org.apache.thrift.AsyncProcessFunction { + public noReturn() { + super("noReturn"); + } + + public noReturn_args getEmptyArgsInstance() { + return new noReturn_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Void o) { + noReturn_result result = new noReturn_result(); + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + noReturn_result result = new noReturn_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + noReturn_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + iface.noReturn(args.delay, resultHandler); + } + } + + public static class oneWayHasArgs + extends org.apache.thrift.AsyncProcessFunction { + public oneWayHasArgs() { + super("oneWayHasArgs"); + } + + public oneWayHasArgs_args getEmptyArgsInstance() { + return new oneWayHasArgs_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(Exception e) {} + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWayHasArgs_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + iface.oneWayHasArgs(args.delay, resultHandler); + } + } + + public static class oneWay + extends org.apache.thrift.AsyncProcessFunction { + public oneWay() { + super("oneWay"); + } + + public oneWay_args getEmptyArgsInstance() { + return new oneWay_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(Exception e) {} + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWay_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + iface.oneWay(resultHandler); + } + } + + public static class oneWayWithError + extends org.apache.thrift.AsyncProcessFunction { + public oneWayWithError() { + super("oneWayWithError"); + } + + public oneWayWithError_args getEmptyArgsInstance() { + return new oneWayWithError_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(Void o) {} + + public void onError(Exception e) {} + }; + } + + protected boolean isOneway() { + return true; + } + + public void start( + I iface, + oneWayWithError_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + iface.oneWayWithError(resultHandler); + } + } + + public static class data + extends org.apache.thrift.AsyncProcessFunction { + public data() { + super("data"); + } + + public data_args getEmptyArgsInstance() { + return new data_args(); + } + + public AsyncMethodCallback getResultHandler( + final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback() { + public void onComplete(UserAccount o) { + data_result result = new data_result(); + result.success = o; + try { + fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + data_result result = new data_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = + (org.apache.thrift.TBase) + new org.apache.thrift.TApplicationException( + org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb, msg, msgType, seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start( + I iface, + data_args args, + org.apache.thrift.async.AsyncMethodCallback resultHandler) + throws TException { + iface.data(args.user, args.account, resultHandler); + } + } + } + + public static class sayHello_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_args"); + + private static final org.apache.thrift.protocol.TField ZONE_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "zone", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new sayHello_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new sayHello_argsTupleSchemeFactory()); + } + + public String zone; // required + public String name; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ZONE((short) 1, "zone"), + NAME((short) 2, "name"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // ZONE + return ZONE; + case 2: // NAME + return NAME; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.ZONE, + new org.apache.thrift.meta_data.FieldMetaData( + "zone", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_args.class, metaDataMap); + } + + public sayHello_args() {} + + public sayHello_args(String zone, String name) { + this(); + this.zone = zone; + this.name = name; + } + + /** Performs a deep copy on other. */ + public sayHello_args(sayHello_args other) { + if (other.isSetZone()) { + this.zone = other.zone; + } + if (other.isSetName()) { + this.name = other.name; + } + } + + public sayHello_args deepCopy() { + return new sayHello_args(this); + } + + @Override + public void clear() { + this.zone = null; + this.name = null; + } + + public String getZone() { + return this.zone; + } + + public sayHello_args setZone(String zone) { + this.zone = zone; + return this; + } + + public void unsetZone() { + this.zone = null; + } + + /** Returns true if field zone is set (has been assigned a value) and false otherwise */ + public boolean isSetZone() { + return this.zone != null; + } + + public void setZoneIsSet(boolean value) { + if (!value) { + this.zone = null; + } + } + + public String getName() { + return this.name; + } + + public sayHello_args setName(String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case ZONE: + if (value == null) { + unsetZone(); + } else { + setZone((String) value); + } + break; + + case NAME: + if (value == null) { + unsetName(); + } else { + setName((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case ZONE: + return getZone(); + + case NAME: + return getName(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case ZONE: + return isSetZone(); + case NAME: + return isSetName(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof sayHello_args) return this.equals((sayHello_args) that); + return false; + } + + public boolean equals(sayHello_args that) { + if (that == null) return false; + + boolean this_present_zone = true && this.isSetZone(); + boolean that_present_zone = true && that.isSetZone(); + if (this_present_zone || that_present_zone) { + if (!(this_present_zone && that_present_zone)) return false; + if (!this.zone.equals(that.zone)) return false; + } + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_zone = true && (isSetZone()); + list.add(present_zone); + if (present_zone) list.add(zone); + + boolean present_name = true && (isSetName()); + list.add(present_name); + if (present_name) list.add(name); + + return list.hashCode(); + } + + @Override + public int compareTo(sayHello_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetZone()).compareTo(other.isSetZone()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetZone()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zone, other.zone); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("sayHello_args("); + boolean first = true; + + sb.append("zone:"); + if (this.zone == null) { + sb.append("null"); + } else { + sb.append(this.zone); + } + first = false; + if (!first) sb.append(", "); + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_argsStandardSchemeFactory implements SchemeFactory { + public sayHello_argsStandardScheme getScheme() { + return new sayHello_argsStandardScheme(); + } + } + + private static class sayHello_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ZONE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.zone != null) { + oprot.writeFieldBegin(ZONE_FIELD_DESC); + oprot.writeString(struct.zone); + oprot.writeFieldEnd(); + } + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_argsTupleSchemeFactory implements SchemeFactory { + public sayHello_argsTupleScheme getScheme() { + return new sayHello_argsTupleScheme(); + } + } + + private static class sayHello_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetZone()) { + optionals.set(0); + } + if (struct.isSetName()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetZone()) { + oprot.writeString(struct.zone); + } + if (struct.isSetName()) { + oprot.writeString(struct.name); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.zone = iprot.readString(); + struct.setZoneIsSet(true); + } + if (incoming.get(1)) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } + } + } + } + + public static class sayHello_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("sayHello_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new sayHello_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new sayHello_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + sayHello_result.class, metaDataMap); + } + + public sayHello_result() {} + + public sayHello_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public sayHello_result(sayHello_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public sayHello_result deepCopy() { + return new sayHello_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public sayHello_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof sayHello_result) return this.equals((sayHello_result) that); + return false; + } + + public boolean equals(sayHello_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(sayHello_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("sayHello_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class sayHello_resultStandardSchemeFactory implements SchemeFactory { + public sayHello_resultStandardScheme getScheme() { + return new sayHello_resultStandardScheme(); + } + } + + private static class sayHello_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, sayHello_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, sayHello_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class sayHello_resultTupleSchemeFactory implements SchemeFactory { + public sayHello_resultTupleScheme getScheme() { + return new sayHello_resultTupleScheme(); + } + } + + private static class sayHello_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, sayHello_result struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withDelay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withDelay_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withDelay_argsTupleSchemeFactory()); + } + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_args.class, metaDataMap); + } + + public withDelay_args() {} + + public withDelay_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public withDelay_args(withDelay_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public withDelay_args deepCopy() { + return new withDelay_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public withDelay_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withDelay_args) return this.equals((withDelay_args) that); + return false; + } + + public boolean equals(withDelay_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_delay = true; + list.add(present_delay); + if (present_delay) list.add(delay); + + return list.hashCode(); + } + + @Override + public int compareTo(withDelay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withDelay_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_argsStandardSchemeFactory implements SchemeFactory { + public withDelay_argsStandardScheme getScheme() { + return new withDelay_argsStandardScheme(); + } + } + + private static class withDelay_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_argsTupleSchemeFactory implements SchemeFactory { + public withDelay_argsTupleScheme getScheme() { + return new withDelay_argsTupleScheme(); + } + } + + private static class withDelay_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + } + + public static class withDelay_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withDelay_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withDelay_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withDelay_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withDelay_result.class, metaDataMap); + } + + public withDelay_result() {} + + public withDelay_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withDelay_result(withDelay_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withDelay_result deepCopy() { + return new withDelay_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withDelay_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withDelay_result) return this.equals((withDelay_result) that); + return false; + } + + public boolean equals(withDelay_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(withDelay_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withDelay_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withDelay_resultStandardSchemeFactory implements SchemeFactory { + public withDelay_resultStandardScheme getScheme() { + return new withDelay_resultStandardScheme(); + } + } + + private static class withDelay_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withDelay_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withDelay_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withDelay_resultTupleSchemeFactory implements SchemeFactory { + public withDelay_resultTupleScheme getScheme() { + return new withDelay_resultTupleScheme(); + } + } + + private static class withDelay_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withDelay_result struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withoutArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withoutArgs_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withoutArgs_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_args.class, metaDataMap); + } + + public withoutArgs_args() {} + + /** Performs a deep copy on other. */ + public withoutArgs_args(withoutArgs_args other) {} + + public withoutArgs_args deepCopy() { + return new withoutArgs_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withoutArgs_args) return this.equals((withoutArgs_args) that); + return false; + } + + public boolean equals(withoutArgs_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + return list.hashCode(); + } + + @Override + public int compareTo(withoutArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withoutArgs_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_argsStandardSchemeFactory implements SchemeFactory { + public withoutArgs_argsStandardScheme getScheme() { + return new withoutArgs_argsStandardScheme(); + } + } + + private static class withoutArgs_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_argsTupleSchemeFactory implements SchemeFactory { + public withoutArgs_argsTupleScheme getScheme() { + return new withoutArgs_argsTupleScheme(); + } + } + + private static class withoutArgs_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class withoutArgs_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withoutArgs_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withoutArgs_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withoutArgs_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withoutArgs_result.class, metaDataMap); + } + + public withoutArgs_result() {} + + public withoutArgs_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withoutArgs_result(withoutArgs_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withoutArgs_result deepCopy() { + return new withoutArgs_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withoutArgs_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withoutArgs_result) return this.equals((withoutArgs_result) that); + return false; + } + + public boolean equals(withoutArgs_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(withoutArgs_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withoutArgs_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withoutArgs_resultStandardSchemeFactory implements SchemeFactory { + public withoutArgs_resultStandardScheme getScheme() { + return new withoutArgs_resultStandardScheme(); + } + } + + private static class withoutArgs_resultStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withoutArgs_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withoutArgs_resultTupleSchemeFactory implements SchemeFactory { + public withoutArgs_resultTupleScheme getScheme() { + return new withoutArgs_resultTupleScheme(); + } + } + + private static class withoutArgs_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withoutArgs_result struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withError_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withError_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_args.class, metaDataMap); + } + + public withError_args() {} + + /** Performs a deep copy on other. */ + public withError_args(withError_args other) {} + + public withError_args deepCopy() { + return new withError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withError_args) return this.equals((withError_args) that); + return false; + } + + public boolean equals(withError_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + return list.hashCode(); + } + + @Override + public int compareTo(withError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_argsStandardSchemeFactory implements SchemeFactory { + public withError_argsStandardScheme getScheme() { + return new withError_argsStandardScheme(); + } + } + + private static class withError_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_argsTupleSchemeFactory implements SchemeFactory { + public withError_argsTupleScheme getScheme() { + return new withError_argsTupleScheme(); + } + } + + private static class withError_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class withError_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withError_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withError_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withError_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withError_result.class, metaDataMap); + } + + public withError_result() {} + + public withError_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withError_result(withError_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withError_result deepCopy() { + return new withError_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withError_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withError_result) return this.equals((withError_result) that); + return false; + } + + public boolean equals(withError_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(withError_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withError_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withError_resultStandardSchemeFactory implements SchemeFactory { + public withError_resultStandardScheme getScheme() { + return new withError_resultStandardScheme(); + } + } + + private static class withError_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withError_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withError_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withError_resultTupleSchemeFactory implements SchemeFactory { + public withError_resultTupleScheme getScheme() { + return new withError_resultTupleScheme(); + } + } + + private static class withError_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withError_result struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class withCollisioin_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_args"); + + private static final org.apache.thrift.protocol.TField INPUT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "input", org.apache.thrift.protocol.TType.STRING, (short) 3333); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withCollisioin_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withCollisioin_argsTupleSchemeFactory()); + } + + public String input; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + INPUT((short) 3333, "input"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 3333: // INPUT + return INPUT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.INPUT, + new org.apache.thrift.meta_data.FieldMetaData( + "input", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_args.class, metaDataMap); + } + + public withCollisioin_args() {} + + public withCollisioin_args(String input) { + this(); + this.input = input; + } + + /** Performs a deep copy on other. */ + public withCollisioin_args(withCollisioin_args other) { + if (other.isSetInput()) { + this.input = other.input; + } + } + + public withCollisioin_args deepCopy() { + return new withCollisioin_args(this); + } + + @Override + public void clear() { + this.input = null; + } + + public String getInput() { + return this.input; + } + + public withCollisioin_args setInput(String input) { + this.input = input; + return this; + } + + public void unsetInput() { + this.input = null; + } + + /** Returns true if field input is set (has been assigned a value) and false otherwise */ + public boolean isSetInput() { + return this.input != null; + } + + public void setInputIsSet(boolean value) { + if (!value) { + this.input = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case INPUT: + if (value == null) { + unsetInput(); + } else { + setInput((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case INPUT: + return getInput(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case INPUT: + return isSetInput(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withCollisioin_args) return this.equals((withCollisioin_args) that); + return false; + } + + public boolean equals(withCollisioin_args that) { + if (that == null) return false; + + boolean this_present_input = true && this.isSetInput(); + boolean that_present_input = true && that.isSetInput(); + if (this_present_input || that_present_input) { + if (!(this_present_input && that_present_input)) return false; + if (!this.input.equals(that.input)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_input = true && (isSetInput()); + list.add(present_input); + if (present_input) list.add(input); + + return list.hashCode(); + } + + @Override + public int compareTo(withCollisioin_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetInput()).compareTo(other.isSetInput()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetInput()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.input, other.input); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withCollisioin_args("); + boolean first = true; + + sb.append("input:"); + if (this.input == null) { + sb.append("null"); + } else { + sb.append(this.input); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_argsStandardSchemeFactory implements SchemeFactory { + public withCollisioin_argsStandardScheme getScheme() { + return new withCollisioin_argsStandardScheme(); + } + } + + private static class withCollisioin_argsStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 3333: // INPUT + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.input != null) { + oprot.writeFieldBegin(INPUT_FIELD_DESC); + oprot.writeString(struct.input); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_argsTupleSchemeFactory implements SchemeFactory { + public withCollisioin_argsTupleScheme getScheme() { + return new withCollisioin_argsTupleScheme(); + } + } + + private static class withCollisioin_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetInput()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetInput()) { + oprot.writeString(struct.input); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.input = iprot.readString(); + struct.setInputIsSet(true); + } + } + } + } + + public static class withCollisioin_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("withCollisioin_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRING, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new withCollisioin_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new withCollisioin_resultTupleSchemeFactory()); + } + + public String success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + withCollisioin_result.class, metaDataMap); + } + + public withCollisioin_result() {} + + public withCollisioin_result(String success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public withCollisioin_result(withCollisioin_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + } + + public withCollisioin_result deepCopy() { + return new withCollisioin_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public String getSuccess() { + return this.success; + } + + public withCollisioin_result setSuccess(String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof withCollisioin_result) return this.equals((withCollisioin_result) that); + return false; + } + + public boolean equals(withCollisioin_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(withCollisioin_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("withCollisioin_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class withCollisioin_resultStandardSchemeFactory implements SchemeFactory { + public withCollisioin_resultStandardScheme getScheme() { + return new withCollisioin_resultStandardScheme(); + } + } + + private static class withCollisioin_resultStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, withCollisioin_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class withCollisioin_resultTupleSchemeFactory implements SchemeFactory { + public withCollisioin_resultTupleScheme getScheme() { + return new withCollisioin_resultTupleScheme(); + } + } + + private static class withCollisioin_resultTupleScheme + extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, withCollisioin_result struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + } + } + } + + public static class noReturn_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new noReturn_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new noReturn_argsTupleSchemeFactory()); + } + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_args.class, metaDataMap); + } + + public noReturn_args() {} + + public noReturn_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public noReturn_args(noReturn_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public noReturn_args deepCopy() { + return new noReturn_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public noReturn_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof noReturn_args) return this.equals((noReturn_args) that); + return false; + } + + public boolean equals(noReturn_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_delay = true; + list.add(present_delay); + if (present_delay) list.add(delay); + + return list.hashCode(); + } + + @Override + public int compareTo(noReturn_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("noReturn_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_argsStandardSchemeFactory implements SchemeFactory { + public noReturn_argsStandardScheme getScheme() { + return new noReturn_argsStandardScheme(); + } + } + + private static class noReturn_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_argsTupleSchemeFactory implements SchemeFactory { + public noReturn_argsTupleScheme getScheme() { + return new noReturn_argsTupleScheme(); + } + } + + private static class noReturn_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + } + + public static class noReturn_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("noReturn_result"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new noReturn_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new noReturn_resultTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + noReturn_result.class, metaDataMap); + } + + public noReturn_result() {} + + /** Performs a deep copy on other. */ + public noReturn_result(noReturn_result other) {} + + public noReturn_result deepCopy() { + return new noReturn_result(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof noReturn_result) return this.equals((noReturn_result) that); + return false; + } + + public boolean equals(noReturn_result that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + return list.hashCode(); + } + + @Override + public int compareTo(noReturn_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("noReturn_result("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class noReturn_resultStandardSchemeFactory implements SchemeFactory { + public noReturn_resultStandardScheme getScheme() { + return new noReturn_resultStandardScheme(); + } + } + + private static class noReturn_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, noReturn_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, noReturn_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class noReturn_resultTupleSchemeFactory implements SchemeFactory { + public noReturn_resultTupleScheme getScheme() { + return new noReturn_resultTupleScheme(); + } + } + + private static class noReturn_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, noReturn_result struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class oneWayHasArgs_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayHasArgs_args"); + + private static final org.apache.thrift.protocol.TField DELAY_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "delay", org.apache.thrift.protocol.TType.I32, (short) 1); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new oneWayHasArgs_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new oneWayHasArgs_argsTupleSchemeFactory()); + } + + public int delay; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + DELAY((short) 1, "delay"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // DELAY + return DELAY; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __DELAY_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.DELAY, + new org.apache.thrift.meta_data.FieldMetaData( + "delay", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayHasArgs_args.class, metaDataMap); + } + + public oneWayHasArgs_args() {} + + public oneWayHasArgs_args(int delay) { + this(); + this.delay = delay; + setDelayIsSet(true); + } + + /** Performs a deep copy on other. */ + public oneWayHasArgs_args(oneWayHasArgs_args other) { + __isset_bitfield = other.__isset_bitfield; + this.delay = other.delay; + } + + public oneWayHasArgs_args deepCopy() { + return new oneWayHasArgs_args(this); + } + + @Override + public void clear() { + setDelayIsSet(false); + this.delay = 0; + } + + public int getDelay() { + return this.delay; + } + + public oneWayHasArgs_args setDelay(int delay) { + this.delay = delay; + setDelayIsSet(true); + return this; + } + + public void unsetDelay() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + /** Returns true if field delay is set (has been assigned a value) and false otherwise */ + public boolean isSetDelay() { + return EncodingUtils.testBit(__isset_bitfield, __DELAY_ISSET_ID); + } + + public void setDelayIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DELAY_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case DELAY: + if (value == null) { + unsetDelay(); + } else { + setDelay((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case DELAY: + return getDelay(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case DELAY: + return isSetDelay(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWayHasArgs_args) return this.equals((oneWayHasArgs_args) that); + return false; + } + + public boolean equals(oneWayHasArgs_args that) { + if (that == null) return false; + + boolean this_present_delay = true; + boolean that_present_delay = true; + if (this_present_delay || that_present_delay) { + if (!(this_present_delay && that_present_delay)) return false; + if (this.delay != that.delay) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_delay = true; + list.add(present_delay); + if (present_delay) list.add(delay); + + return list.hashCode(); + } + + @Override + public int compareTo(oneWayHasArgs_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetDelay()).compareTo(other.isSetDelay()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDelay()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delay, other.delay); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWayHasArgs_args("); + boolean first = true; + + sb.append("delay:"); + sb.append(this.delay); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayHasArgs_argsStandardSchemeFactory implements SchemeFactory { + public oneWayHasArgs_argsStandardScheme getScheme() { + return new oneWayHasArgs_argsStandardScheme(); + } + } + + private static class oneWayHasArgs_argsStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // DELAY + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(DELAY_FIELD_DESC); + oprot.writeI32(struct.delay); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayHasArgs_argsTupleSchemeFactory implements SchemeFactory { + public oneWayHasArgs_argsTupleScheme getScheme() { + return new oneWayHasArgs_argsTupleScheme(); + } + } + + private static class oneWayHasArgs_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetDelay()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetDelay()) { + oprot.writeI32(struct.delay); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayHasArgs_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.delay = iprot.readI32(); + struct.setDelayIsSet(true); + } + } + } + } + + public static class oneWay_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWay_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new oneWay_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new oneWay_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWay_args.class, metaDataMap); + } + + public oneWay_args() {} + + /** Performs a deep copy on other. */ + public oneWay_args(oneWay_args other) {} + + public oneWay_args deepCopy() { + return new oneWay_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWay_args) return this.equals((oneWay_args) that); + return false; + } + + public boolean equals(oneWay_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + return list.hashCode(); + } + + @Override + public int compareTo(oneWay_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWay_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWay_argsStandardSchemeFactory implements SchemeFactory { + public oneWay_argsStandardScheme getScheme() { + return new oneWay_argsStandardScheme(); + } + } + + private static class oneWay_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWay_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWay_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWay_argsTupleSchemeFactory implements SchemeFactory { + public oneWay_argsTupleScheme getScheme() { + return new oneWay_argsTupleScheme(); + } + } + + private static class oneWay_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWay_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class oneWayWithError_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("oneWayWithError_args"); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new oneWayWithError_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new oneWayWithError_argsTupleSchemeFactory()); + } + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ; + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + oneWayWithError_args.class, metaDataMap); + } + + public oneWayWithError_args() {} + + /** Performs a deep copy on other. */ + public oneWayWithError_args(oneWayWithError_args other) {} + + public oneWayWithError_args deepCopy() { + return new oneWayWithError_args(this); + } + + @Override + public void clear() {} + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof oneWayWithError_args) return this.equals((oneWayWithError_args) that); + return false; + } + + public boolean equals(oneWayWithError_args that) { + if (that == null) return false; + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + return list.hashCode(); + } + + @Override + public int compareTo(oneWayWithError_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("oneWayWithError_args("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class oneWayWithError_argsStandardSchemeFactory implements SchemeFactory { + public oneWayWithError_argsStandardScheme getScheme() { + return new oneWayWithError_argsStandardScheme(); + } + } + + private static class oneWayWithError_argsStandardScheme + extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class oneWayWithError_argsTupleSchemeFactory implements SchemeFactory { + public oneWayWithError_argsTupleScheme getScheme() { + return new oneWayWithError_argsTupleScheme(); + } + } + + private static class oneWayWithError_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, oneWayWithError_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + } + + public static class data_args + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_args"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new data_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new data_argsTupleSchemeFactory()); + } + + public User user; // required + public Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(data_args.class, metaDataMap); + } + + public data_args() {} + + public data_args(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public data_args(data_args other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public data_args deepCopy() { + return new data_args(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + public User getUser() { + return this.user; + } + + public data_args setUser(User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + public Account getAccount() { + return this.account; + } + + public data_args setAccount(Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof data_args) return this.equals((data_args) that); + return false; + } + + public boolean equals(data_args that) { + if (that == null) return false; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_user = true && (isSetUser()); + list.add(present_user); + if (present_user) list.add(user); + + boolean present_account = true && (isSetAccount()); + list.add(present_account); + if (present_account) list.add(account); + + return list.hashCode(); + } + + @Override + public int compareTo(data_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetUser()).compareTo(other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAccount()).compareTo(other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("data_args("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_argsStandardSchemeFactory implements SchemeFactory { + public data_argsStandardScheme getScheme() { + return new data_argsStandardScheme(); + } + } + + private static class data_argsStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_args struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_args struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_argsTupleSchemeFactory implements SchemeFactory { + public data_argsTupleScheme getScheme() { + return new data_argsTupleScheme(); + } + } + + private static class data_argsTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetUser()) { + optionals.set(0); + } + if (struct.isSetAccount()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetUser()) { + struct.user.write(oprot); + } + if (struct.isSetAccount()) { + struct.account.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_args struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } + if (incoming.get(1)) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } + } + } + + public static class data_result + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("data_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "success", org.apache.thrift.protocol.TType.STRUCT, (short) 0); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new data_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new data_resultTupleSchemeFactory()); + } + + public UserAccount success; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short) 0, "success"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.SUCCESS, + new org.apache.thrift.meta_data.FieldMetaData( + "success", + org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, UserAccount.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( + data_result.class, metaDataMap); + } + + public data_result() {} + + public data_result(UserAccount success) { + this(); + this.success = success; + } + + /** Performs a deep copy on other. */ + public data_result(data_result other) { + if (other.isSetSuccess()) { + this.success = new UserAccount(other.success); + } + } + + public data_result deepCopy() { + return new data_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public UserAccount getSuccess() { + return this.success; + } + + public data_result setSuccess(UserAccount success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((UserAccount) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof data_result) return this.equals((data_result) that); + return false; + } + + public boolean equals(data_result that) { + if (that == null) return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) return false; + if (!this.success.equals(that.success)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_success = true && (isSetSuccess()); + list.add(present_success); + if (present_success) list.add(success); + + return list.hashCode(); + } + + @Override + public int compareTo(data_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) + throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("data_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + if (success != null) { + success.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class data_resultStandardSchemeFactory implements SchemeFactory { + public data_resultStandardScheme getScheme() { + return new data_resultStandardScheme(); + } + } + + private static class data_resultStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, data_result struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate + // method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, data_result struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + struct.success.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class data_resultTupleSchemeFactory implements SchemeFactory { + public data_resultTupleScheme getScheme() { + return new data_resultTupleScheme(); + } + } + + private static class data_resultTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + struct.success.write(oprot); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, data_result struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = new UserAccount(); + struct.success.read(iprot); + struct.setSuccessIsSet(true); + } + } + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_3/User.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_3/User.java new file mode 100644 index 000000000000..942bc0048089 --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_3/User.java @@ -0,0 +1,598 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_9_3; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.server.AbstractNonblockingServer.*; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2025-02-27") +public class User + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("User"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "name", org.apache.thrift.protocol.TType.STRING, (short) 1); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "userId", org.apache.thrift.protocol.TType.STRING, (short) 2); + private static final org.apache.thrift.protocol.TField AGE_FIELD_DESC = + new org.apache.thrift.protocol.TField("age", org.apache.thrift.protocol.TType.I32, (short) 3); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new UserStandardSchemeFactory()); + schemes.put(TupleScheme.class, new UserTupleSchemeFactory()); + } + + public String name; // required + public String userId; // required + public int age; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + NAME((short) 1, "name"), + USER_ID((short) 2, "userId"), + AGE((short) 3, "age"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // NAME + return NAME; + case 2: // USER_ID + return USER_ID; + case 3: // AGE + return AGE; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __AGE_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.NAME, + new org.apache.thrift.meta_data.FieldMetaData( + "name", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.USER_ID, + new org.apache.thrift.meta_data.FieldMetaData( + "userId", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.STRING))); + tmpMap.put( + _Fields.AGE, + new org.apache.thrift.meta_data.FieldMetaData( + "age", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData( + org.apache.thrift.protocol.TType.I32))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(User.class, metaDataMap); + } + + public User() {} + + public User(String name, String userId, int age) { + this(); + this.name = name; + this.userId = userId; + this.age = age; + setAgeIsSet(true); + } + + /** Performs a deep copy on other. */ + public User(User other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetName()) { + this.name = other.name; + } + if (other.isSetUserId()) { + this.userId = other.userId; + } + this.age = other.age; + } + + public User deepCopy() { + return new User(this); + } + + @Override + public void clear() { + this.name = null; + this.userId = null; + setAgeIsSet(false); + this.age = 0; + } + + public String getName() { + return this.name; + } + + public User setName(String name) { + this.name = name; + return this; + } + + public void unsetName() { + this.name = null; + } + + /** Returns true if field name is set (has been assigned a value) and false otherwise */ + public boolean isSetName() { + return this.name != null; + } + + public void setNameIsSet(boolean value) { + if (!value) { + this.name = null; + } + } + + public String getUserId() { + return this.userId; + } + + public User setUserId(String userId) { + this.userId = userId; + return this; + } + + public void unsetUserId() { + this.userId = null; + } + + /** Returns true if field userId is set (has been assigned a value) and false otherwise */ + public boolean isSetUserId() { + return this.userId != null; + } + + public void setUserIdIsSet(boolean value) { + if (!value) { + this.userId = null; + } + } + + public int getAge() { + return this.age; + } + + public User setAge(int age) { + this.age = age; + setAgeIsSet(true); + return this; + } + + public void unsetAge() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __AGE_ISSET_ID); + } + + /** Returns true if field age is set (has been assigned a value) and false otherwise */ + public boolean isSetAge() { + return EncodingUtils.testBit(__isset_bitfield, __AGE_ISSET_ID); + } + + public void setAgeIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __AGE_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case NAME: + if (value == null) { + unsetName(); + } else { + setName((String) value); + } + break; + + case USER_ID: + if (value == null) { + unsetUserId(); + } else { + setUserId((String) value); + } + break; + + case AGE: + if (value == null) { + unsetAge(); + } else { + setAge((Integer) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case NAME: + return getName(); + + case USER_ID: + return getUserId(); + + case AGE: + return getAge(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case NAME: + return isSetName(); + case USER_ID: + return isSetUserId(); + case AGE: + return isSetAge(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof User) return this.equals((User) that); + return false; + } + + public boolean equals(User that) { + if (that == null) return false; + + boolean this_present_name = true && this.isSetName(); + boolean that_present_name = true && that.isSetName(); + if (this_present_name || that_present_name) { + if (!(this_present_name && that_present_name)) return false; + if (!this.name.equals(that.name)) return false; + } + + boolean this_present_userId = true && this.isSetUserId(); + boolean that_present_userId = true && that.isSetUserId(); + if (this_present_userId || that_present_userId) { + if (!(this_present_userId && that_present_userId)) return false; + if (!this.userId.equals(that.userId)) return false; + } + + boolean this_present_age = true; + boolean that_present_age = true; + if (this_present_age || that_present_age) { + if (!(this_present_age && that_present_age)) return false; + if (this.age != that.age) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_name = true && (isSetName()); + list.add(present_name); + if (present_name) list.add(name); + + boolean present_userId = true && (isSetUserId()); + list.add(present_userId); + if (present_userId) list.add(userId); + + boolean present_age = true; + list.add(present_age); + if (present_age) list.add(age); + + return list.hashCode(); + } + + @Override + public int compareTo(User other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetUserId()).compareTo(other.isSetUserId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAge()).compareTo(other.isSetAge()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAge()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.age, other.age); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("User("); + boolean first = true; + + sb.append("name:"); + if (this.name == null) { + sb.append("null"); + } else { + sb.append(this.name); + } + first = false; + if (!first) sb.append(", "); + sb.append("userId:"); + if (this.userId == null) { + sb.append("null"); + } else { + sb.append(this.userId); + } + first = false; + if (!first) sb.append(", "); + sb.append("age:"); + sb.append(this.age); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (name == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'name' was not present! Struct: " + toString()); + } + if (userId == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'userId' was not present! Struct: " + toString()); + } + // alas, we cannot check 'age' because it's a primitive and you chose the non-beans generator. + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and + // doesn't call the default constructor. + __isset_bitfield = 0; + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserStandardSchemeFactory implements SchemeFactory { + public UserStandardScheme getScheme() { + return new UserStandardScheme(); + } + } + + private static class UserStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, User struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.name = iprot.readString(); + struct.setNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // AGE + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + if (!struct.isSetAge()) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'age' was not found in serialized data! Struct: " + toString()); + } + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, User struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.name != null) { + oprot.writeFieldBegin(NAME_FIELD_DESC); + oprot.writeString(struct.name); + oprot.writeFieldEnd(); + } + if (struct.userId != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userId); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(AGE_FIELD_DESC); + oprot.writeI32(struct.age); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserTupleSchemeFactory implements SchemeFactory { + public UserTupleScheme getScheme() { + return new UserTupleScheme(); + } + } + + private static class UserTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeString(struct.name); + oprot.writeString(struct.userId); + oprot.writeI32(struct.age); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, User struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.name = iprot.readString(); + struct.setNameIsSet(true); + struct.userId = iprot.readString(); + struct.setUserIdIsSet(true); + struct.age = iprot.readI32(); + struct.setAgeIsSet(true); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_3/UserAccount.java b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_3/UserAccount.java new file mode 100644 index 000000000000..138770fcfcfb --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/java/io/opentelemetry/javaagent/thrift/v0_9_3/UserAccount.java @@ -0,0 +1,503 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.javaagent.thrift.v0_9_3; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.server.AbstractNonblockingServer.*; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2025-02-27") +public class UserAccount + implements org.apache.thrift.TBase, + java.io.Serializable, + Cloneable, + Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = + new org.apache.thrift.protocol.TStruct("UserAccount"); + + private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "user", org.apache.thrift.protocol.TType.STRUCT, (short) 1); + private static final org.apache.thrift.protocol.TField ACCOUNT_FIELD_DESC = + new org.apache.thrift.protocol.TField( + "account", org.apache.thrift.protocol.TType.STRUCT, (short) 2); + + private static final Map, SchemeFactory> schemes = + new HashMap, SchemeFactory>(); + + static { + schemes.put(StandardScheme.class, new UserAccountStandardSchemeFactory()); + schemes.put(TupleScheme.class, new UserAccountTupleSchemeFactory()); + } + + public User user; // required + public Account account; // required + + /** + * The set of fields this struct contains, along with convenience methods for finding and + * manipulating them. + */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + USER((short) 1, "user"), + ACCOUNT((short) 2, "account"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** Find the _Fields constant that matches fieldId, or null if its not found. */ + public static _Fields findByThriftId(int fieldId) { + switch (fieldId) { + case 1: // USER + return USER; + case 2: // ACCOUNT + return ACCOUNT; + default: + return null; + } + } + + /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) + throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** Find the _Fields constant that matches name, or null if its not found. */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = + new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put( + _Fields.USER, + new org.apache.thrift.meta_data.FieldMetaData( + "user", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, User.class))); + tmpMap.put( + _Fields.ACCOUNT, + new org.apache.thrift.meta_data.FieldMetaData( + "account", + org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.StructMetaData( + org.apache.thrift.protocol.TType.STRUCT, Account.class))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserAccount.class, metaDataMap); + } + + public UserAccount() {} + + public UserAccount(User user, Account account) { + this(); + this.user = user; + this.account = account; + } + + /** Performs a deep copy on other. */ + public UserAccount(UserAccount other) { + if (other.isSetUser()) { + this.user = new User(other.user); + } + if (other.isSetAccount()) { + this.account = new Account(other.account); + } + } + + public UserAccount deepCopy() { + return new UserAccount(this); + } + + @Override + public void clear() { + this.user = null; + this.account = null; + } + + public User getUser() { + return this.user; + } + + public UserAccount setUser(User user) { + this.user = user; + return this; + } + + public void unsetUser() { + this.user = null; + } + + /** Returns true if field user is set (has been assigned a value) and false otherwise */ + public boolean isSetUser() { + return this.user != null; + } + + public void setUserIsSet(boolean value) { + if (!value) { + this.user = null; + } + } + + public Account getAccount() { + return this.account; + } + + public UserAccount setAccount(Account account) { + this.account = account; + return this; + } + + public void unsetAccount() { + this.account = null; + } + + /** Returns true if field account is set (has been assigned a value) and false otherwise */ + public boolean isSetAccount() { + return this.account != null; + } + + public void setAccountIsSet(boolean value) { + if (!value) { + this.account = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case USER: + if (value == null) { + unsetUser(); + } else { + setUser((User) value); + } + break; + + case ACCOUNT: + if (value == null) { + unsetAccount(); + } else { + setAccount((Account) value); + } + break; + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case USER: + return getUser(); + + case ACCOUNT: + return getAccount(); + } + throw new IllegalStateException(); + } + + /** + * Returns true if field corresponding to fieldID is set (has been assigned a value) and false + * otherwise + */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case USER: + return isSetUser(); + case ACCOUNT: + return isSetAccount(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) return false; + if (that instanceof UserAccount) return this.equals((UserAccount) that); + return false; + } + + public boolean equals(UserAccount that) { + if (that == null) return false; + + boolean this_present_user = true && this.isSetUser(); + boolean that_present_user = true && that.isSetUser(); + if (this_present_user || that_present_user) { + if (!(this_present_user && that_present_user)) return false; + if (!this.user.equals(that.user)) return false; + } + + boolean this_present_account = true && this.isSetAccount(); + boolean that_present_account = true && that.isSetAccount(); + if (this_present_account || that_present_account) { + if (!(this_present_account && that_present_account)) return false; + if (!this.account.equals(that.account)) return false; + } + + return true; + } + + @Override + public int hashCode() { + List list = new ArrayList(); + + boolean present_user = true && (isSetUser()); + list.add(present_user); + if (present_user) list.add(user); + + boolean present_account = true && (isSetAccount()); + list.add(present_account); + if (present_account) list.add(account); + + return list.hashCode(); + } + + @Override + public int compareTo(UserAccount other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetUser()).compareTo(other.isSetUser()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUser()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAccount()).compareTo(other.isSetAccount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.account, other.account); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) + throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("UserAccount("); + boolean first = true; + + sb.append("user:"); + if (this.user == null) { + sb.append("null"); + } else { + sb.append(this.user); + } + first = false; + if (!first) sb.append(", "); + sb.append("account:"); + if (this.account == null) { + sb.append("null"); + } else { + sb.append(this.account); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + if (user == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'user' was not present! Struct: " + toString()); + } + if (account == null) { + throw new org.apache.thrift.protocol.TProtocolException( + "Required field 'account' was not present! Struct: " + toString()); + } + // check for sub-struct validity + if (user != null) { + user.validate(); + } + if (account != null) { + account.validate(); + } + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException { + try { + read( + new org.apache.thrift.protocol.TCompactProtocol( + new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class UserAccountStandardSchemeFactory implements SchemeFactory { + public UserAccountStandardScheme getScheme() { + return new UserAccountStandardScheme(); + } + } + + private static class UserAccountStandardScheme extends StandardScheme { + + public void read(org.apache.thrift.protocol.TProtocol iprot, UserAccount struct) + throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // USER + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // ACCOUNT + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, UserAccount struct) + throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.user != null) { + oprot.writeFieldBegin(USER_FIELD_DESC); + struct.user.write(oprot); + oprot.writeFieldEnd(); + } + if (struct.account != null) { + oprot.writeFieldBegin(ACCOUNT_FIELD_DESC); + struct.account.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + } + + private static class UserAccountTupleSchemeFactory implements SchemeFactory { + public UserAccountTupleScheme getScheme() { + return new UserAccountTupleScheme(); + } + } + + private static class UserAccountTupleScheme extends TupleScheme { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + struct.user.write(oprot); + struct.account.write(oprot); + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, UserAccount struct) + throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.user = new User(); + struct.user.read(iprot); + struct.setUserIsSet(true); + struct.account = new Account(); + struct.account.read(iprot); + struct.setAccountIsSet(true); + } + } +} diff --git a/instrumentation/thrift/thrift-common/library/src/test/resources/ThriftService.thrift b/instrumentation/thrift/thrift-common/library/src/test/resources/ThriftService.thrift new file mode 100644 index 000000000000..94186e7f60ea --- /dev/null +++ b/instrumentation/thrift/thrift-common/library/src/test/resources/ThriftService.thrift @@ -0,0 +1,31 @@ +namespace java io.opentelemetry.javaagent.thrift.thrift + +struct Account { + 1:required string zone; + 2:required string cardId; +} + +struct User { + 1:required string name; + 2:required string userId; + 3:required i32 age; +} + +struct UserAccount{ + 1:required User user; + 2:required Account account; +} + +service ThriftService { + string sayHello(1:string zone,2:string name); + string withDelay(1:i32 delay); + string withoutArgs(); + string withError(); + string withCollisioin(3333:string input); + void noReturn(1:i32 delay); + oneway void oneWayHasArgs(1:i32 delay); + oneway void oneWay(); + oneway void oneWayWithError(); + UserAccount data(1:User user,2:Account account); +} + diff --git a/settings.gradle.kts b/settings.gradle.kts index eda7bdfb88c5..71a77b4b4477 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -553,6 +553,14 @@ include(":instrumentation:vibur-dbcp-11.0:testing") include(":instrumentation:wicket-8.0:javaagent") include(":instrumentation:zio:zio-2.0:javaagent") +include(":instrumentation:eleven:demo-first:javaagent") +include(":instrumentation:thrift:thrift-0.7.0:javaagent") +include(":instrumentation:thrift:thrift-0.9.1:javaagent") +include(":instrumentation:thrift:thrift-common:library") +include(":instrumentation:thrift:thrift-0.9.0-testing") +include(":instrumentation:thrift:thrift-0.9.2-testing") +include(":instrumentation:thrift:thrift-0.9.3-testing") +include(":instrumentation:thrift:thrift-0.14.0-testing") // benchmark include(":benchmark-overhead-jmh") include(":benchmark-jfr-analyzer")