diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..dcdb4c2
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,18 @@
+logs
+project/project
+project/target
+target
+tmp
+.history
+dist
+/.idea
+/*.iml
+/out
+/.idea_modules
+/.classpath
+/.project
+/RUNNING_PID
+/.settings
+/.target/
+/bin/
+/.cache
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..e885d4e
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,20 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 btnguyen2k
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..518890f
--- /dev/null
+++ b/README.md
@@ -0,0 +1,61 @@
+queue-jclient
+=============
+
+Java client for [https://github.com/btnguyen2k/queue-server](https://github.com/btnguyen2k/queue-server).
+
+## Release-notes ##
+
+Latest release: `0.1.0`.
+
+See [RELEASE-NOTES.md](RELEASE-NOTES.md).
+
+## Usage ##
+
+```java
+// obtain an IQueueClient instance: REST client
+IQueueClient queueClient = new RestQueueClient().setQueueServerUrl("http://localhost:8080").init();
+//or preferred way
+IQueueClient queueClient = RestQueueClientFactory.newQueueClient("http://localhost:8080");
+
+// obtain an IQueueClient instance: Thrift client
+IQueueClient queueClient = new ThriftqueueClient().setQueueServerHostsAndPorts("localhost:9090,host2:9090,host3:9090").init();
+//or preferred way
+IQueueClient queueClient = ThriftqueueClientFactory.newQueueClient("localhost:9090,host2:9090,host3:9090");
+// Thrift client supports host fail-over!
+
+// obtain an IQueueClient instance: Thrift-over-http client
+IQueueClient queueClient = new ThriftHttpQueueClient().setQueueServerUrls("http://localhost:8080/thrift,http://host2/thrift,http://host3/thrift").init();
+//or preferred way
+IQueueClient queueClient = ThriftHttpQueueClientFactory.newQueueClient("http://localhost:8080/thrift,http://host2/thrift,http://host3/thrift");
+// Thrift client supports host fail-over!
+```
+
+```java
+// do some cool stuff
+
+// initialize a queue
+QueueResponse response = queueClient.initQueue("secret", "queue_name");
+
+// queue a message
+QueueResponse response = queueClient.queue("secret", "queue_name", "message".getBytes());
+// or, queue a message
+QueueMessage msg = new QueueMessage();
+msg.content("message content".getBytes());
+QueueResponse response = queueClient.queue("secret", "queue_name", msg);
+
+// take a message out of queue
+QueueResponse response = queueClient.take("secret", "queue_name");
+QueueMessage msg = response.queueMessage;
+
+// call method "finish" when done with the message to cleanup ephemeral storage
+QueueResponse response = queueClient.finish("secret", "queue_name", msg);
+
+// or, requeue the message to retry latter
+QueueResponse response = queueClient.requeue("secret", "queue_name", msg);
+```
+
+## License ##
+
+See [LICENSE.txt](LICENSE.txt) for details. Copyright (c) 2015 btnguyen2k.
+
+Third party libraries are distributed under their own license(s).
diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
new file mode 100644
index 0000000..7776715
--- /dev/null
+++ b/RELEASE-NOTES.md
@@ -0,0 +1,10 @@
+queue-jclient Release Notes
+===========================
+
+Java client for [https://github.com/btnguyen2k/queue-server](https://github.com/btnguyen2k/queue-server).
+
+2015-06-16: v0.1.0
+------------------
+First release:
+
+- REST & Thrift client
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..41a8190
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,119 @@
+
+ 4.0.0
+
+
+ com.github.ddth
+ ddth-parent
+ 2
+
+
+ queue-jclient
+ 0.1.0-SNAPSHOT
+ jar
+
+ queue-jclient
+ Java client for queue-server
+ https://github.com/btnguyen2k/queue-jclient
+
+
+ git@github.com:btnguyen2k/queue-jclient
+ scm:git:git@github.com:btnguyen2k/queue-jclient
+ scm:git:git@github.com:btnguyen2k/queue-jclient
+
+
+
+ btnguyen2k
+ Thanh Ba Nguyen
+ btnguyen2k@gmail.com
+
+
+
+
+ true
+ 2.5.3
+
+
+
+
+ junit
+ junit
+ ${version.junit}
+ test
+
+
+ com.yammer.metrics
+ metrics-core
+ 2.2.0
+ test
+
+
+
+ com.github.ddth
+ ddth-commons
+ 0.3.1
+
+
+
+ com.github.ddth
+ ddth-thriftpool
+ 0.2.1.3
+
+
+ org.apache.thrift
+ libthrift
+ 0.9.2
+
+
+
+ org.apache.httpcomponents
+ httpasyncclient
+ 4.1
+
+
+ org.apache.httpcomponents
+ httpclient
+ 4.4.1
+
+
+ org.apache.httpcomponents
+ httpcore
+ 4.4.1
+
+
+ org.apache.commons
+ commons-io
+ 1.3.2
+
+
+
+ org.jodd
+ jodd-http
+ 3.6.5
+
+
+ com.fasterxml.jackson.core
+ jackson-core
+ ${version.jackson}
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ ${version.jackson}
+
+
+
+
+
+
+ maven-surefire-plugin
+
+ ${skipTests}
+
+ file:${basedir}/etc/log4j.xml
+
+
+
+
+
+
diff --git a/src/main/java/com/github/btnguyen2k/queue/jclient/IQueueClient.java b/src/main/java/com/github/btnguyen2k/queue/jclient/IQueueClient.java
new file mode 100644
index 0000000..5c5a6cb
--- /dev/null
+++ b/src/main/java/com/github/btnguyen2k/queue/jclient/IQueueClient.java
@@ -0,0 +1,105 @@
+package com.github.btnguyen2k.queue.jclient;
+
+/**
+ * Client API to interact with queue-server.
+ *
+ * @author Thanh Nguyen
+ * @since 0.1.0
+ */
+public interface IQueueClient {
+
+ /**
+ * Checks if a queue exists.
+ *
+ * @param secret
+ * @param queueName
+ * @return
+ */
+ public QueueResponse queueExists(String secret, String queueName);
+
+ /**
+ * Creates & Initializes a new queue.
+ *
+ * @param secret
+ * @param queueName
+ * @return
+ */
+ public QueueResponse initQueue(String secret, String queueName);
+
+ /**
+ * Puts a message to a queue.
+ *
+ * @param secret
+ * @param queueName
+ * @param content
+ * @return
+ */
+ public QueueResponse queue(String secret, String queueName, byte[] content);
+
+ /**
+ * Puts a message to a queue.
+ *
+ * @param secret
+ * @param queueName
+ * @param queueMessage
+ * @return
+ */
+ public QueueResponse queue(String secret, String queueName, QueueMessage queueMessage);
+
+ /**
+ * Re-queues a message.
+ *
+ * @param secret
+ * @param queueName
+ * @param queueMessage
+ * @return
+ */
+ public QueueResponse requeue(String secret, String queueName, QueueMessage queueMessage);
+
+ /**
+ * Re-queues a message silently.
+ *
+ * @param secret
+ * @param queueName
+ * @param queueMessage
+ * @return
+ */
+ public QueueResponse requeueSilent(String secret, String queueName, QueueMessage queueMessage);
+
+ /**
+ * Called when finish processing the message to cleanup ephemeral storage.
+ *
+ * @param secret
+ * @param queueName
+ * @param queueMessage
+ * @return
+ */
+ public QueueResponse finish(String secret, String queueName, QueueMessage queueMessage);
+
+ /**
+ * Takes a message from a queue.
+ *
+ * @param secret
+ * @param queueName
+ * @return
+ */
+ public QueueResponse take(String secret, String queueName);
+
+ /**
+ * Gets number of items currently in a queue.
+ *
+ * @param secret
+ * @param queueName
+ * @return
+ */
+ public QueueSizeResponse queueSize(String secret, String queueName);
+
+ /**
+ * Gets number of items currently in a queue's ephemeral storage.
+ *
+ * @param secret
+ * @param queueName
+ * @return
+ */
+ public QueueSizeResponse ephemeralSize(String secret, String queueName);
+}
diff --git a/src/main/java/com/github/btnguyen2k/queue/jclient/QueueMessage.java b/src/main/java/com/github/btnguyen2k/queue/jclient/QueueMessage.java
new file mode 100644
index 0000000..ded9a4a
--- /dev/null
+++ b/src/main/java/com/github/btnguyen2k/queue/jclient/QueueMessage.java
@@ -0,0 +1,110 @@
+package com.github.btnguyen2k.queue.jclient;
+
+import java.util.Date;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+import com.github.btnguyen2k.queueserver.thrift.TQueueMessage;
+
+/**
+ * Represent a queue message from/to queue-server.
+ *
+ * @author Thanh Nguyen
+ * @since 0.1.0
+ */
+public class QueueMessage {
+
+ public static QueueMessage newInstance(TQueueMessage _msg) {
+ if (_msg == null) {
+ return null;
+ }
+ QueueMessage msg = new QueueMessage();
+ msg.queueId = _msg.getQueueId();
+ msg.orgTimestamp = new Date(_msg.getMsgOrgTimestamp());
+ msg.timestamp = new Date(_msg.getMsgOrgTimestamp());
+ msg.numRequeues = _msg.getMsgNumRequeues();
+ msg.content = _msg.getMsgContent();
+ return msg;
+ }
+
+ /**
+ * Message's queue unique id.
+ */
+ public long queueId;
+
+ /**
+ * Timestamp when the message was first put to the queue.
+ */
+ public Date orgTimestamp;
+
+ /**
+ * Timestamp when the message was last put to the queue.
+ */
+ public Date timestamp;
+
+ /**
+ * How many times has the message been put to the queue.
+ */
+ public int numRequeues;
+
+ /**
+ * Message content.
+ */
+ public byte[] content;
+
+ public QueueMessage() {
+ }
+
+ public QueueMessage(long queueId, Date orgTimestamp, Date timestamp, int numRequeues,
+ byte[] content) {
+ this.queueId = queueId;
+ this.orgTimestamp = orgTimestamp;
+ this.timestamp = timestamp;
+ this.numRequeues = numRequeues;
+ this.content = content;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString() {
+ ToStringBuilder tsb = new ToStringBuilder(null);
+ tsb.append("queue_id", queueId);
+ tsb.append("org_timestamp", orgTimestamp);
+ tsb.append("timestamp", timestamp);
+ tsb.append("num_requeues", numRequeues);
+ tsb.append("content", content);
+ return tsb.build();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int hashCode() {
+ HashCodeBuilder hcb = new HashCodeBuilder(19, 81);
+ hcb.append(queueId);
+ return hcb.hashCode();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof QueueMessage) {
+ QueueMessage other = (QueueMessage) obj;
+
+ EqualsBuilder eq = new EqualsBuilder();
+ eq.append(queueId, other.queueId);
+ eq.append(orgTimestamp, other.orgTimestamp);
+ eq.append(timestamp, other.timestamp);
+ eq.append(numRequeues, other.numRequeues);
+ eq.append(content, other.content);
+ }
+ return false;
+ }
+}
diff --git a/src/main/java/com/github/btnguyen2k/queue/jclient/QueueResponse.java b/src/main/java/com/github/btnguyen2k/queue/jclient/QueueResponse.java
new file mode 100644
index 0000000..b550018
--- /dev/null
+++ b/src/main/java/com/github/btnguyen2k/queue/jclient/QueueResponse.java
@@ -0,0 +1,71 @@
+package com.github.btnguyen2k.queue.jclient;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * Response from queue-server API call.
+ *
+ * @author Thanh Nguyen
+ * @since 0.1.0
+ */
+public class QueueResponse {
+
+ public int status;
+ public String message;
+ public boolean result;
+ public QueueMessage queueMessage;
+
+ public QueueResponse() {
+ }
+
+ public QueueResponse(int status, String message, boolean result, QueueMessage queueMessage) {
+ this.status = status;
+ this.message = message;
+ this.result = result;
+ this.queueMessage = queueMessage;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString() {
+ ToStringBuilder tsb = new ToStringBuilder(null);
+ tsb.append("status", status);
+ tsb.append("message", message);
+ tsb.append("result", result);
+ tsb.append("queueMessage", queueMessage);
+ return tsb.build();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int hashCode() {
+ HashCodeBuilder hcb = new HashCodeBuilder(19, 81);
+ hcb.append(status);
+ hcb.append(message);
+ hcb.append(result);
+ hcb.append(queueMessage);
+ return hcb.hashCode();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof QueueResponse) {
+ QueueResponse other = (QueueResponse) obj;
+
+ EqualsBuilder eq = new EqualsBuilder();
+ eq.append(status, other.status);
+ eq.append(message, other.message);
+ eq.append(queueMessage, other.queueMessage);
+ }
+ return false;
+ }
+}
diff --git a/src/main/java/com/github/btnguyen2k/queue/jclient/QueueSizeResponse.java b/src/main/java/com/github/btnguyen2k/queue/jclient/QueueSizeResponse.java
new file mode 100644
index 0000000..fd6bba9
--- /dev/null
+++ b/src/main/java/com/github/btnguyen2k/queue/jclient/QueueSizeResponse.java
@@ -0,0 +1,67 @@
+package com.github.btnguyen2k.queue.jclient;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * Size-response from queue-server API call.
+ *
+ * @author Thanh Nguyen
+ * @since 0.1.0
+ */
+public class QueueSizeResponse {
+
+ public int status;
+ public long size;
+ public String message;
+
+ public QueueSizeResponse() {
+ }
+
+ public QueueSizeResponse(int status, String message, long size) {
+ this.status = status;
+ this.message = message;
+ this.size = size;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString() {
+ ToStringBuilder tsb = new ToStringBuilder(null);
+ tsb.append("status", status);
+ tsb.append("message", message);
+ tsb.append("size", size);
+ return tsb.build();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int hashCode() {
+ HashCodeBuilder hcb = new HashCodeBuilder(19, 81);
+ hcb.append(status);
+ hcb.append(message);
+ hcb.append(size);
+ return hcb.hashCode();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof QueueSizeResponse) {
+ QueueSizeResponse other = (QueueSizeResponse) obj;
+
+ EqualsBuilder eq = new EqualsBuilder();
+ eq.append(status, other.status);
+ eq.append(message, other.message);
+ eq.append(size, other.size);
+ }
+ return false;
+ }
+}
diff --git a/src/main/java/com/github/btnguyen2k/queue/jclient/impl/AbstractQueueClient.java b/src/main/java/com/github/btnguyen2k/queue/jclient/impl/AbstractQueueClient.java
new file mode 100644
index 0000000..c5af1a3
--- /dev/null
+++ b/src/main/java/com/github/btnguyen2k/queue/jclient/impl/AbstractQueueClient.java
@@ -0,0 +1,20 @@
+package com.github.btnguyen2k.queue.jclient.impl;
+
+import com.github.btnguyen2k.queue.jclient.IQueueClient;
+
+/**
+ * Abstract implementation of {@link IQueueClient}.
+ *
+ * @author Thanh Nguyen
+ * @since 0.1.0
+ */
+public abstract class AbstractQueueClient implements IQueueClient {
+
+ public AbstractQueueClient init() {
+ return this;
+ }
+
+ public void destroy() {
+ }
+
+}
diff --git a/src/main/java/com/github/btnguyen2k/queue/jclient/impl/AbstractThriftQueueClient.java b/src/main/java/com/github/btnguyen2k/queue/jclient/impl/AbstractThriftQueueClient.java
new file mode 100644
index 0000000..8ffe368
--- /dev/null
+++ b/src/main/java/com/github/btnguyen2k/queue/jclient/impl/AbstractThriftQueueClient.java
@@ -0,0 +1,314 @@
+package com.github.btnguyen2k.queue.jclient.impl;
+
+import java.nio.ByteBuffer;
+import java.util.Date;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.github.btnguyen2k.queue.jclient.IQueueClient;
+import com.github.btnguyen2k.queue.jclient.QueueMessage;
+import com.github.btnguyen2k.queue.jclient.QueueResponse;
+import com.github.btnguyen2k.queue.jclient.QueueSizeResponse;
+import com.github.btnguyen2k.queueserver.thrift.TQueueMessage;
+import com.github.btnguyen2k.queueserver.thrift.TQueueResponse;
+import com.github.btnguyen2k.queueserver.thrift.TQueueService;
+import com.github.btnguyen2k.queueserver.thrift.TQueueSizeResponse;
+import com.github.ddth.thriftpool.ThriftClientPool;
+
+/**
+ * Abstract Thrift-implementation of {@link IQueueClient}.
+ *
+ * @author Thanh Nguyen
+ * @since 0.1.0
+ */
+public abstract class AbstractThriftQueueClient extends AbstractQueueClient {
+
+ private Logger LOGGER = LoggerFactory.getLogger(AbstractThriftQueueClient.class);
+
+ protected ThriftClientPool thriftClientPool;
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void destroy() {
+ if (thriftClientPool != null) {
+ try {
+ thriftClientPool.destroy();
+ } catch (Exception e) {
+ }
+ }
+
+ super.destroy();
+ }
+
+ private static QueueResponse makeResponse(TQueueResponse serverResponse) {
+ if (serverResponse == null) {
+ return makeResponse(500, "Empty server response / Server-side exception.", false, null);
+ }
+ QueueResponse response = new QueueResponse(serverResponse.getStatus(),
+ serverResponse.getMessage(), serverResponse.isResult(),
+ QueueMessage.newInstance(serverResponse.getQueueMessage()));
+ return response;
+ }
+
+ private static QueueResponse makeResponse(int status, String message, boolean result,
+ QueueMessage queueMessage) {
+ QueueResponse response = new QueueResponse(status, message, result, queueMessage);
+ return response;
+ }
+
+ private static QueueSizeResponse makeSizeResponse(TQueueSizeResponse serverResponse) {
+ if (serverResponse == null) {
+ return makeSizeResponse(500, "Empty server response / Server-side exception.", -1);
+ }
+ QueueSizeResponse response = new QueueSizeResponse(serverResponse.getStatus(),
+ serverResponse.getMessage(), serverResponse.getSize());
+ return response;
+ }
+
+ private static QueueSizeResponse makeSizeResponse(int status, String message, long size) {
+ QueueSizeResponse response = new QueueSizeResponse(status, message, size);
+ return response;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public QueueResponse queueExists(String secret, String queueName) {
+ try {
+ TQueueResponse serverResponse = null;
+ TQueueService.Iface queueClient = thriftClientPool.borrowObject();
+ if (queueClient != null) {
+ try {
+ serverResponse = queueClient.queueExists(secret, queueName);
+ } finally {
+ thriftClientPool.returnObject(queueClient);
+ }
+ }
+ return makeResponse(serverResponse);
+ } catch (Exception e) {
+ LOGGER.warn(e.getMessage(), e);
+ return makeResponse(500, e.getMessage(), false, null);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public QueueResponse initQueue(String secret, String queueName) {
+ try {
+ TQueueResponse serverResponse = null;
+ TQueueService.Iface queueClient = thriftClientPool.borrowObject();
+ if (queueClient != null) {
+ try {
+ serverResponse = queueClient.initQueue(secret, queueName);
+ } finally {
+ thriftClientPool.returnObject(queueClient);
+ }
+ }
+ return makeResponse(serverResponse);
+ } catch (Exception e) {
+ LOGGER.warn(e.getMessage(), e);
+ return makeResponse(500, e.getMessage(), false, null);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public QueueResponse queue(String secret, String queueName, byte[] content) {
+ try {
+ TQueueResponse serverResponse = null;
+ TQueueService.Iface queueClient = thriftClientPool.borrowObject();
+ if (queueClient != null) {
+ try {
+ Date now = new Date();
+ serverResponse = queueClient.queue(
+ secret,
+ queueName,
+ new TQueueMessage(0L, now.getTime(), now.getTime(), 0, ByteBuffer
+ .wrap(content)));
+ } finally {
+ thriftClientPool.returnObject(queueClient);
+ }
+ }
+ return makeResponse(serverResponse);
+ } catch (Exception e) {
+ LOGGER.warn(e.getMessage(), e);
+ return makeResponse(500, e.getMessage(), false, null);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public QueueResponse queue(String secret, String queueName, QueueMessage queueMessage) {
+ return queue(secret, queueName, queueMessage.content);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public QueueResponse requeue(String secret, String queueName, QueueMessage queueMessage) {
+ try {
+ TQueueResponse serverResponse = null;
+ TQueueService.Iface queueClient = thriftClientPool.borrowObject();
+ if (queueClient != null) {
+ try {
+ Date now = new Date();
+ serverResponse = queueClient.requeue(
+ secret,
+ queueName,
+ new TQueueMessage(queueMessage.queueId,
+ queueMessage.orgTimestamp != null ? queueMessage.orgTimestamp
+ .getTime() : now.getTime(),
+ queueMessage.timestamp != null ? queueMessage.timestamp
+ .getTime() : now.getTime(), queueMessage.numRequeues,
+ ByteBuffer.wrap(queueMessage.content)));
+ } finally {
+ thriftClientPool.returnObject(queueClient);
+ }
+ }
+ return makeResponse(serverResponse);
+ } catch (Exception e) {
+ LOGGER.warn(e.getMessage(), e);
+ return makeResponse(500, e.getMessage(), false, null);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public QueueResponse requeueSilent(String secret, String queueName, QueueMessage queueMessage) {
+ try {
+ TQueueResponse serverResponse = null;
+ TQueueService.Iface queueClient = thriftClientPool.borrowObject();
+ if (queueClient != null) {
+ try {
+ Date now = new Date();
+ serverResponse = queueClient.requeueSilent(
+ secret,
+ queueName,
+ new TQueueMessage(queueMessage.queueId,
+ queueMessage.orgTimestamp != null ? queueMessage.orgTimestamp
+ .getTime() : now.getTime(),
+ queueMessage.timestamp != null ? queueMessage.timestamp
+ .getTime() : now.getTime(), queueMessage.numRequeues,
+ ByteBuffer.wrap(queueMessage.content)));
+ } finally {
+ thriftClientPool.returnObject(queueClient);
+ }
+ }
+ return makeResponse(serverResponse);
+ } catch (Exception e) {
+ LOGGER.warn(e.getMessage(), e);
+ return makeResponse(500, e.getMessage(), false, null);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public QueueResponse finish(String secret, String queueName, QueueMessage queueMessage) {
+ try {
+ TQueueResponse serverResponse = null;
+ TQueueService.Iface queueClient = thriftClientPool.borrowObject();
+ if (queueClient != null) {
+ try {
+ Date now = new Date();
+ serverResponse = queueClient.finish(
+ secret,
+ queueName,
+ new TQueueMessage(queueMessage.queueId,
+ queueMessage.orgTimestamp != null ? queueMessage.orgTimestamp
+ .getTime() : now.getTime(),
+ queueMessage.timestamp != null ? queueMessage.timestamp
+ .getTime() : now.getTime(), queueMessage.numRequeues,
+ ByteBuffer.wrap(queueMessage.content)));
+ } finally {
+ thriftClientPool.returnObject(queueClient);
+ }
+ }
+ return makeResponse(serverResponse);
+ } catch (Exception e) {
+ LOGGER.warn(e.getMessage(), e);
+ return makeResponse(500, e.getMessage(), false, null);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public QueueResponse take(String secret, String queueName) {
+ try {
+ TQueueResponse serverResponse = null;
+ TQueueService.Iface queueClient = thriftClientPool.borrowObject();
+ if (queueClient != null) {
+ try {
+ serverResponse = queueClient.take(secret, queueName);
+ } finally {
+ thriftClientPool.returnObject(queueClient);
+ }
+ }
+ return makeResponse(serverResponse);
+ } catch (Exception e) {
+ LOGGER.warn(e.getMessage(), e);
+ return makeResponse(500, e.getMessage(), false, null);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public QueueSizeResponse queueSize(String secret, String queueName) {
+ try {
+ TQueueSizeResponse serverResponse = null;
+ TQueueService.Iface queueClient = thriftClientPool.borrowObject();
+ if (queueClient != null) {
+ try {
+ serverResponse = queueClient.queueSize(secret, queueName);
+ } finally {
+ thriftClientPool.returnObject(queueClient);
+ }
+ }
+ return makeSizeResponse(serverResponse);
+ } catch (Exception e) {
+ LOGGER.warn(e.getMessage(), e);
+ return makeSizeResponse(500, e.getMessage(), -1);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public QueueSizeResponse ephemeralSize(String secret, String queueName) {
+ try {
+ TQueueSizeResponse serverResponse = null;
+ TQueueService.Iface queueClient = thriftClientPool.borrowObject();
+ if (queueClient != null) {
+ try {
+ serverResponse = queueClient.ephemeralSize(secret, queueName);
+ } finally {
+ thriftClientPool.returnObject(queueClient);
+ }
+ }
+ return makeSizeResponse(serverResponse);
+ } catch (Exception e) {
+ LOGGER.warn(e.getMessage(), e);
+ return makeSizeResponse(500, e.getMessage(), -1);
+ }
+ }
+
+}
diff --git a/src/main/java/com/github/btnguyen2k/queue/jclient/impl/RestQueueClient.java b/src/main/java/com/github/btnguyen2k/queue/jclient/impl/RestQueueClient.java
new file mode 100644
index 0000000..bb615d1
--- /dev/null
+++ b/src/main/java/com/github/btnguyen2k/queue/jclient/impl/RestQueueClient.java
@@ -0,0 +1,277 @@
+package com.github.btnguyen2k.queue.jclient.impl;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import jodd.http.HttpRequest;
+import jodd.http.HttpResponse;
+
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.github.btnguyen2k.queue.jclient.IQueueClient;
+import com.github.btnguyen2k.queue.jclient.QueueMessage;
+import com.github.btnguyen2k.queue.jclient.QueueResponse;
+import com.github.btnguyen2k.queue.jclient.QueueSizeResponse;
+import com.github.btnguyen2k.queue.jclient.utils.QueueClientUtils;
+import com.github.ddth.commons.utils.DPathUtils;
+import com.github.ddth.commons.utils.SerializationUtils;
+
+/**
+ * REST-implementation of {@link IQueueClient}.
+ *
+ * @author Thanh Nguyen
+ * @since 0.1.0
+ */
+public class RestQueueClient extends AbstractQueueClient {
+
+ private Logger LOGGER = LoggerFactory.getLogger(RestQueueClient.class);
+
+ private String queueServerUrl;
+
+ public RestQueueClient() {
+ }
+
+ public RestQueueClient(String queueServerUrl) {
+ setQueueServerUrl(queueServerUrl);
+ }
+
+ public String getQueueServerUrl() {
+ return queueServerUrl;
+ }
+
+ public RestQueueClient setQueueServerUrl(String queueServerUrl) {
+ this.queueServerUrl = queueServerUrl;
+ if (this.queueServerUrl.endsWith("/")) {
+ this.queueServerUrl = this.queueServerUrl
+ .substring(0, this.queueServerUrl.length() - 1);
+ }
+ return this;
+ }
+
+ private Map callApi(String url, Object data) {
+ return callApi(url, data, "POST");
+ }
+
+ @SuppressWarnings("unchecked")
+ private Map callApi(String url, Object data, String method) {
+ try {
+ HttpRequest httpRequest = StringUtils.equalsIgnoreCase("POST", method) ? HttpRequest
+ .post(url) : HttpRequest.get(url);
+ if (data != null) {
+ httpRequest.body(SerializationUtils.toJsonString(data));
+ }
+ HttpResponse httpResponse = httpRequest.timeout(10000).send();
+ try {
+ if (httpResponse.statusCode() != 200) {
+ return null;
+ }
+ int contentLength = Integer.parseInt(httpResponse.contentLength());
+ if (contentLength == 0 || contentLength > 1024) {
+ LOGGER.warn("Invalid response length: " + contentLength);
+ return null;
+ }
+ return SerializationUtils.fromJsonString(httpResponse.charset("UTF-8").bodyText(),
+ Map.class);
+ } finally {
+ httpResponse.close();
+ }
+ } catch (Exception e) {
+ LOGGER.warn(e.getMessage(), e);
+ return null;
+ }
+ }
+
+ public static QueueMessage queueMessageFromResponse(Object value) {
+ if (value == null) {
+ return null;
+ }
+ Long qId = DPathUtils.getValue(value, "queue_id", Long.class);
+ Date qOrgTimestamp = DPathUtils.getValue(value, "org_timestamp", Date.class);
+ Date qTimestamp = DPathUtils.getValue(value, "timestamp", Date.class);
+ Integer qNumRequeues = DPathUtils.getValue(value, "num_requeues", Integer.class);
+ String contentBase64 = DPathUtils.getValue(value, "content", String.class);
+
+ QueueMessage queueMessage = new QueueMessage();
+ queueMessage.queueId = qId != null ? qId.longValue() : 0;
+ queueMessage.orgTimestamp = qOrgTimestamp;
+ queueMessage.timestamp = qTimestamp;
+ queueMessage.numRequeues = qNumRequeues != null ? qNumRequeues.intValue() : 0;
+ queueMessage.content = QueueClientUtils.base64Decode(contentBase64);
+
+ return queueMessage;
+ }
+
+ private static QueueSizeResponse makeSizeResponse(Map serverResponse) {
+ if (serverResponse == null) {
+ return makeSizeResponse(500, "Empty server response / Server-side exception.", -1);
+ }
+ Integer status = DPathUtils.getValue(serverResponse, "s", Integer.class);
+ String message = DPathUtils.getValue(serverResponse, "m", String.class);
+ Long size = DPathUtils.getValue(serverResponse, "v", Long.class);
+
+ QueueSizeResponse response = new QueueSizeResponse(status != null ? status.intValue() : 0,
+ message, size != null ? size.longValue() : -1);
+ return response;
+ }
+
+ private static QueueSizeResponse makeSizeResponse(int status, String message, long size) {
+ QueueSizeResponse response = new QueueSizeResponse(status, message, size);
+ return response;
+ }
+
+ private static QueueResponse makeResponse(Map serverResponse) {
+ if (serverResponse == null) {
+ return makeResponse(500, "Empty server response / Server-side exception.", false, null);
+ }
+ Integer status = DPathUtils.getValue(serverResponse, "s", Integer.class);
+ String message = DPathUtils.getValue(serverResponse, "m", String.class);
+ Boolean result = DPathUtils.getValue(serverResponse, "r", Boolean.class);
+ Object value = DPathUtils.getValue(serverResponse, "v");
+
+ QueueResponse response = new QueueResponse(status != null ? status.intValue() : 0, message,
+ result != null ? result.booleanValue() : false, queueMessageFromResponse(value));
+ return response;
+ }
+
+ private static QueueResponse makeResponse(int status, String message, boolean result,
+ QueueMessage queueMessage) {
+ QueueResponse response = new QueueResponse(status, message, result, queueMessage);
+ return response;
+ }
+
+ private static Map makeRequestParams(String secret, String queueName) {
+ Map params = new HashMap();
+ params.put("secret", secret);
+ params.put("queue_name", queueName);
+ return params;
+ }
+
+ private static Map makeRequestParams(String secret, String queueName,
+ byte[] content) {
+ Map params = makeRequestParams(secret, queueName);
+ params.put("content", QueueClientUtils.base64Encode(content));
+ return params;
+ }
+
+ private static Map makeRequestParams(String secret, String queueName,
+ QueueMessage queueMessage) {
+ Map params = makeRequestParams(secret, queueName);
+ params.put("queue_id", queueMessage.queueId);
+ params.put("org_timestamp", queueMessage.orgTimestamp);
+ params.put("timestamp", queueMessage.timestamp);
+ params.put("num_requeues", queueMessage.numRequeues);
+ params.put("content", QueueClientUtils.base64Encode(queueMessage.content));
+ return params;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public QueueResponse queueExists(String secret, String queueName) {
+ String apiUri = "/queueExists";
+ Map params = makeRequestParams(secret, queueName);
+ Map apiResult = callApi(queueServerUrl + apiUri, params);
+ return makeResponse(apiResult);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public QueueResponse initQueue(String secret, String queueName) {
+ String apiUri = "/initQueue";
+ Map params = makeRequestParams(secret, queueName);
+ Map apiResult = callApi(queueServerUrl + apiUri, params);
+ return makeResponse(apiResult);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public QueueResponse queue(String secret, String queueName, byte[] content) {
+ String apiUri = "/queue";
+ Map params = makeRequestParams(secret, queueName, content);
+ Map apiResult = callApi(queueServerUrl + apiUri, params);
+ return makeResponse(apiResult);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public QueueResponse queue(String secret, String queueName, QueueMessage queueMessage) {
+ return queue(secret, queueName, queueMessage.content);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public QueueResponse requeue(String secret, String queueName, QueueMessage queueMessage) {
+ String apiUri = "/requeue";
+ Map params = makeRequestParams(secret, queueName, queueMessage);
+ Map apiResult = callApi(queueServerUrl + apiUri, params);
+ return makeResponse(apiResult);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public QueueResponse requeueSilent(String secret, String queueName, QueueMessage queueMessage) {
+ String apiUri = "/requeueSilent";
+ Map params = makeRequestParams(secret, queueName, queueMessage);
+ Map apiResult = callApi(queueServerUrl + apiUri, params);
+ return makeResponse(apiResult);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public QueueResponse finish(String secret, String queueName, QueueMessage queueMessage) {
+ String apiUri = "/finish";
+ Map params = makeRequestParams(secret, queueName, queueMessage);
+ Map apiResult = callApi(queueServerUrl + apiUri, params);
+ return makeResponse(apiResult);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public QueueResponse take(String secret, String queueName) {
+ String apiUri = "/take";
+ Map params = makeRequestParams(secret, queueName);
+ Map apiResult = callApi(queueServerUrl + apiUri, params);
+ return makeResponse(apiResult);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public QueueSizeResponse queueSize(String secret, String queueName) {
+ String apiUri = "/queueSize";
+ Map params = makeRequestParams(secret, queueName);
+ Map apiResult = callApi(queueServerUrl + apiUri, params);
+ return makeSizeResponse(apiResult);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public QueueSizeResponse ephemeralSize(String secret, String queueName) {
+ String apiUri = "/ephemeralSize";
+ Map params = makeRequestParams(secret, queueName);
+ Map apiResult = callApi(queueServerUrl + apiUri, params);
+ return makeSizeResponse(apiResult);
+ }
+
+}
diff --git a/src/main/java/com/github/btnguyen2k/queue/jclient/impl/RestQueueClientFactory.java b/src/main/java/com/github/btnguyen2k/queue/jclient/impl/RestQueueClientFactory.java
new file mode 100644
index 0000000..9c874e7
--- /dev/null
+++ b/src/main/java/com/github/btnguyen2k/queue/jclient/impl/RestQueueClientFactory.java
@@ -0,0 +1,50 @@
+package com.github.btnguyen2k.queue.jclient.impl;
+
+import java.util.concurrent.ExecutionException;
+
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.CacheLoader;
+import com.google.common.cache.LoadingCache;
+import com.google.common.cache.RemovalListener;
+import com.google.common.cache.RemovalNotification;
+
+/**
+ * Factory to create {@link RestQueueClient}.
+ *
+ * @author Thanh Nguyen
+ * @since 0.1.0
+ */
+public class RestQueueClientFactory {
+ private static LoadingCache cache = CacheBuilder.newBuilder()
+ .removalListener(new RemovalListener() {
+ @Override
+ public void onRemoval(RemovalNotification notification) {
+ notification.getValue().destroy();
+ }
+ }).build(new CacheLoader() {
+ @Override
+ public RestQueueClient load(String queueServerUrl) throws Exception {
+ RestQueueClient queueClient = new RestQueueClient();
+ queueClient.setQueueServerUrl(queueServerUrl).init();
+ return queueClient;
+ }
+ });
+
+ public static void cleanup() {
+ cache.invalidateAll();
+ }
+
+ /**
+ * Helper method to create a new {@link RestQueueClient} instance.
+ *
+ * @param queueServerUrl
+ * @return
+ */
+ public static RestQueueClient newQueueClient(String queueServerUrl) {
+ try {
+ return cache.get(queueServerUrl);
+ } catch (ExecutionException e) {
+ return null;
+ }
+ }
+}
diff --git a/src/main/java/com/github/btnguyen2k/queue/jclient/impl/ThriftHttpQueueClient.java b/src/main/java/com/github/btnguyen2k/queue/jclient/impl/ThriftHttpQueueClient.java
new file mode 100644
index 0000000..d0982db
--- /dev/null
+++ b/src/main/java/com/github/btnguyen2k/queue/jclient/impl/ThriftHttpQueueClient.java
@@ -0,0 +1,136 @@
+package com.github.btnguyen2k.queue.jclient.impl;
+
+import org.apache.http.config.SocketConfig;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.thrift.protocol.TCompactProtocol;
+import org.apache.thrift.protocol.TProtocol;
+import org.apache.thrift.transport.THttpClient;
+import org.apache.thrift.transport.TTransport;
+import org.apache.thrift.transport.TTransportException;
+
+import com.github.btnguyen2k.queue.jclient.IQueueClient;
+import com.github.btnguyen2k.queueserver.thrift.TQueueService;
+import com.github.ddth.thriftpool.AbstractTProtocolFactory;
+import com.github.ddth.thriftpool.ITProtocolFactory;
+import com.github.ddth.thriftpool.PoolConfig;
+import com.github.ddth.thriftpool.ThriftClientPool;
+
+/**
+ * Thrift-over-http implementation of {@link IQueueClient}.
+ *
+ * @author Thanh Nguyen
+ * @since 0.1.0
+ */
+public class ThriftHttpQueueClient extends AbstractThriftQueueClient {
+
+ private String thriftServerUrls = "http://localhost:9000/thrift";
+
+ /**
+ * Constructs a new {@link ThriftHttpQueueClient} object.
+ */
+ public ThriftHttpQueueClient() {
+ }
+
+ /**
+ * Constructs a new {@link ThriftHttpQueueClient} object.
+ *
+ * @param queueServerUrls
+ * format
+ * {@code http://host1:port1/uri1,https://host2:port2/uri2,http://host3:port3/uri3...}
+ */
+ public ThriftHttpQueueClient(String queueServerUrls) {
+ setQueueServerUrls(queueServerUrls);
+ }
+
+ /**
+ * Format
+ * {@code http://host1:port1/uri1,https://host2:port2/uri2,http://host3:port3/uri3...}
+ *
+ * @return
+ */
+ public String getQueueServerUrls() {
+ return thriftServerUrls;
+ }
+
+ /**
+ * format
+ * {@code http://host1:port1/uri1,https://host2:port2/uri2,http://host3:port3/uri3...}
+ *
+ * @param queueServerUrls
+ * @return
+ */
+ public ThriftHttpQueueClient setQueueServerUrls(String queueServerUrls) {
+ this.thriftServerUrls = queueServerUrls;
+ return this;
+ }
+
+ private static class MyTProtocolFactory extends AbstractTProtocolFactory {
+ public MyTProtocolFactory(String queueServerUrls) {
+ super(queueServerUrls);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected void parseHostAndPortList() {
+ String[] urlTokens = getHostsAndPorts().split("[,\\s]+");
+
+ clearHostAndPortList();
+ for (String url : urlTokens) {
+ HostAndPort hap = new HostAndPort(url);
+ addHostAndPort(hap);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected TProtocol create(HostAndPort hostAndPort) throws Exception {
+ SocketConfig config = SocketConfig.custom().setSoTimeout(10000).build();
+ CloseableHttpClient httpClient = HttpClients.custom().disableAuthCaching()
+ .disableCookieManagement().setDefaultSocketConfig(config).build();
+ // .createMinimal();
+ TTransport transport = new THttpClient(hostAndPort.host, httpClient);
+ try {
+ transport.open();
+ } catch (TTransportException e) {
+ transport.close();
+ throw e;
+ }
+ TProtocol protocol = new TCompactProtocol(transport);
+ return protocol;
+ }
+ }
+
+ /**
+ * Helper method to create a new {@link ITProtocolFactory} for queue-server
+ * Thrift-over-http client.
+ *
+ * @param queueServerUrls
+ * @return
+ */
+ public static ITProtocolFactory protocolFactory(final String queueServerUrls) {
+ ITProtocolFactory protocolFactory = new MyTProtocolFactory(queueServerUrls);
+ return protocolFactory;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ThriftHttpQueueClient init() {
+ super.init();
+
+ final int timeout = 10000;
+ thriftClientPool = new ThriftClientPool();
+ thriftClientPool.setClientClass(TQueueService.Client.class).setClientInterface(
+ TQueueService.Iface.class);
+ thriftClientPool.setTProtocolFactory(protocolFactory(thriftServerUrls));
+ thriftClientPool.setPoolConfig(new PoolConfig().setMaxActive(32).setMaxWaitTime(timeout));
+ thriftClientPool.init();
+
+ return this;
+ }
+}
diff --git a/src/main/java/com/github/btnguyen2k/queue/jclient/impl/ThriftHttpQueueClientFactory.java b/src/main/java/com/github/btnguyen2k/queue/jclient/impl/ThriftHttpQueueClientFactory.java
new file mode 100644
index 0000000..a6c9b93
--- /dev/null
+++ b/src/main/java/com/github/btnguyen2k/queue/jclient/impl/ThriftHttpQueueClientFactory.java
@@ -0,0 +1,54 @@
+package com.github.btnguyen2k.queue.jclient.impl;
+
+import java.util.concurrent.ExecutionException;
+
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.CacheLoader;
+import com.google.common.cache.LoadingCache;
+import com.google.common.cache.RemovalListener;
+import com.google.common.cache.RemovalNotification;
+
+/**
+ * Factory to create {@link ThriftHttpQueueClient}.
+ *
+ * @author Thanh Nguyen
+ * @since 0.1.0
+ */
+public class ThriftHttpQueueClientFactory {
+ private static LoadingCache cache = CacheBuilder.newBuilder()
+ .removalListener(new RemovalListener() {
+ @Override
+ public void onRemoval(
+ RemovalNotification notification) {
+ notification.getValue().destroy();
+ }
+ }).build(new CacheLoader() {
+ @Override
+ public ThriftHttpQueueClient load(String urls) throws Exception {
+ ThriftHttpQueueClient queueClient = new ThriftHttpQueueClient(urls);
+ queueClient.init();
+ return queueClient;
+ }
+ });
+
+ public static void cleanup() {
+ cache.invalidateAll();
+ }
+
+ /**
+ * Helper method to create a new {@link ThriftHttpQueueClient} instance.
+ *
+ * @param urls
+ * format
+ * {@code http://host1:port1/uri1,https://host2:port2/uri2,http://host3:port3/uri3...}
+ * @return
+ */
+ public static ThriftHttpQueueClient newQueueClient(String urls) {
+ try {
+ return cache.get(urls);
+ } catch (ExecutionException e) {
+ return null;
+ }
+ }
+
+}
diff --git a/src/main/java/com/github/btnguyen2k/queue/jclient/impl/ThriftQueueClient.java b/src/main/java/com/github/btnguyen2k/queue/jclient/impl/ThriftQueueClient.java
new file mode 100644
index 0000000..6831885
--- /dev/null
+++ b/src/main/java/com/github/btnguyen2k/queue/jclient/impl/ThriftQueueClient.java
@@ -0,0 +1,97 @@
+package com.github.btnguyen2k.queue.jclient.impl;
+
+import org.apache.thrift.protocol.TCompactProtocol;
+import org.apache.thrift.protocol.TProtocol;
+import org.apache.thrift.transport.TFramedTransport;
+import org.apache.thrift.transport.TSocket;
+import org.apache.thrift.transport.TTransport;
+import org.apache.thrift.transport.TTransportException;
+
+import com.github.btnguyen2k.queue.jclient.IQueueClient;
+import com.github.btnguyen2k.queueserver.thrift.TQueueService;
+import com.github.ddth.thriftpool.AbstractTProtocolFactory;
+import com.github.ddth.thriftpool.ITProtocolFactory;
+import com.github.ddth.thriftpool.PoolConfig;
+import com.github.ddth.thriftpool.ThriftClientPool;
+
+/**
+ * Thrift-implementation of {@link IQueueClient}.
+ *
+ * @author Thanh Nguyen
+ * @since 0.1.0
+ */
+public class ThriftQueueClient extends AbstractThriftQueueClient {
+
+ private String queueServerHostsAndPorts = "localhost:9090";
+
+ /**
+ * Constructs a new {@link ThriftQueueClient} object.
+ */
+ public ThriftQueueClient() {
+ }
+
+ /**
+ * Constructs a new {@link ThriftQueueClient} object.
+ *
+ * @param queueServerHostsAndPorts
+ * format {@code host1:port1,host2:port2,host3:port3...}
+ */
+ public ThriftQueueClient(String queueServerHostsAndPorts) {
+ setQueueServerHostsAndPorts(queueServerHostsAndPorts);
+ }
+
+ public String getQueueServerHostsAndPorts() {
+ return queueServerHostsAndPorts;
+ }
+
+ public ThriftQueueClient setQueueServerHostsAndPorts(String queueServerHostsAndPorts) {
+ this.queueServerHostsAndPorts = queueServerHostsAndPorts;
+ return this;
+ }
+
+ /**
+ * Helper method to create a new {@link ITProtocolFactory} for queue-server
+ * Thrift client.
+ *
+ * @param hostsAndPorts
+ * @param soTimeout
+ * @return
+ */
+ public static ITProtocolFactory protocolFactory(final String hostsAndPorts, final int soTimeout) {
+ ITProtocolFactory protocolFactory = new AbstractTProtocolFactory(hostsAndPorts) {
+ @Override
+ protected TProtocol create(HostAndPort hostAndPort) throws Exception {
+ TSocket socket = new TSocket(hostAndPort.host, hostAndPort.port);
+ socket.setTimeout(soTimeout);
+ TTransport transport = new TFramedTransport(socket);
+ try {
+ transport.open();
+ } catch (TTransportException e) {
+ transport.close();
+ throw e;
+ }
+ TProtocol protocol = new TCompactProtocol(transport);
+ return protocol;
+ }
+ };
+ return protocolFactory;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ThriftQueueClient init() {
+ super.init();
+
+ final int timeout = 10000000;
+ thriftClientPool = new ThriftClientPool();
+ thriftClientPool.setClientClass(TQueueService.Client.class).setClientInterface(
+ TQueueService.Iface.class);
+ thriftClientPool.setTProtocolFactory(protocolFactory(queueServerHostsAndPorts, timeout));
+ thriftClientPool.setPoolConfig(new PoolConfig().setMaxActive(32).setMaxWaitTime(timeout));
+ thriftClientPool.init();
+
+ return this;
+ }
+}
diff --git a/src/main/java/com/github/btnguyen2k/queue/jclient/impl/ThriftQueueClientFactory.java b/src/main/java/com/github/btnguyen2k/queue/jclient/impl/ThriftQueueClientFactory.java
new file mode 100644
index 0000000..e2cd042
--- /dev/null
+++ b/src/main/java/com/github/btnguyen2k/queue/jclient/impl/ThriftQueueClientFactory.java
@@ -0,0 +1,52 @@
+package com.github.btnguyen2k.queue.jclient.impl;
+
+import java.util.concurrent.ExecutionException;
+
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.CacheLoader;
+import com.google.common.cache.LoadingCache;
+import com.google.common.cache.RemovalListener;
+import com.google.common.cache.RemovalNotification;
+
+/**
+ * Factory to create {@link ThriftQueueClient}.
+ *
+ * @author Thanh Nguyen
+ * @since 0.1.0
+ */
+public class ThriftQueueClientFactory {
+ private static LoadingCache cache = CacheBuilder.newBuilder()
+ .removalListener(new RemovalListener() {
+ @Override
+ public void onRemoval(RemovalNotification notification) {
+ notification.getValue().destroy();
+ }
+ }).build(new CacheLoader() {
+ @Override
+ public ThriftQueueClient load(String hostsAndPorts) throws Exception {
+ ThriftQueueClient queueClient = new ThriftQueueClient(hostsAndPorts);
+ queueClient.init();
+ return queueClient;
+ }
+ });
+
+ public static void cleanup() {
+ cache.invalidateAll();
+ }
+
+ /**
+ * Helper method to create a new {@link ThriftQueueClient} instance.
+ *
+ * @param hostsAndPorts
+ * format {@code host1:port1,host2:port2,host3:port3...}
+ * @return
+ */
+ public static ThriftQueueClient newQueueClient(String hostAndPort) {
+ try {
+ return cache.get(hostAndPort);
+ } catch (ExecutionException e) {
+ return null;
+ }
+ }
+
+}
diff --git a/src/main/java/com/github/btnguyen2k/queue/jclient/utils/QueueClientUtils.java b/src/main/java/com/github/btnguyen2k/queue/jclient/utils/QueueClientUtils.java
new file mode 100644
index 0000000..6b090b4
--- /dev/null
+++ b/src/main/java/com/github/btnguyen2k/queue/jclient/utils/QueueClientUtils.java
@@ -0,0 +1,19 @@
+package com.github.btnguyen2k.queue.jclient.utils;
+
+import org.apache.commons.codec.binary.Base64;
+
+/**
+ * Utility class.
+ *
+ * @author Thanh Nguyen
+ * @since 0.1.0
+ */
+public class QueueClientUtils {
+ public static byte[] base64Decode(String encodedStr) {
+ return encodedStr != null ? Base64.decodeBase64(encodedStr) : null;
+ }
+
+ public static String base64Encode(byte[] data) {
+ return data != null ? Base64.encodeBase64String(data) : null;
+ }
+}
diff --git a/src/main/java/com/github/btnguyen2k/queueserver/thrift/TQueueMessage.java b/src/main/java/com/github/btnguyen2k/queueserver/thrift/TQueueMessage.java
new file mode 100644
index 0000000..ddee286
--- /dev/null
+++ b/src/main/java/com/github/btnguyen2k/queueserver/thrift/TQueueMessage.java
@@ -0,0 +1,787 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.1)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package com.github.btnguyen2k.queueserver.thrift;
+
+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.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TQueueMessage implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TQueueMessage");
+
+ private static final org.apache.thrift.protocol.TField QUEUE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("queueId", org.apache.thrift.protocol.TType.I64, (short)1);
+ private static final org.apache.thrift.protocol.TField MSG_ORG_TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("msgOrgTimestamp", org.apache.thrift.protocol.TType.I64, (short)2);
+ private static final org.apache.thrift.protocol.TField MSG_TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("msgTimestamp", org.apache.thrift.protocol.TType.I64, (short)3);
+ private static final org.apache.thrift.protocol.TField MSG_NUM_REQUEUES_FIELD_DESC = new org.apache.thrift.protocol.TField("msgNumRequeues", org.apache.thrift.protocol.TType.I32, (short)4);
+ private static final org.apache.thrift.protocol.TField MSG_CONTENT_FIELD_DESC = new org.apache.thrift.protocol.TField("msgContent", org.apache.thrift.protocol.TType.STRING, (short)5);
+
+ private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TQueueMessageStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TQueueMessageTupleSchemeFactory());
+ }
+
+ public long queueId; // required
+ public long msgOrgTimestamp; // required
+ public long msgTimestamp; // required
+ public int msgNumRequeues; // required
+ public ByteBuffer msgContent; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ QUEUE_ID((short)1, "queueId"),
+ MSG_ORG_TIMESTAMP((short)2, "msgOrgTimestamp"),
+ MSG_TIMESTAMP((short)3, "msgTimestamp"),
+ MSG_NUM_REQUEUES((short)4, "msgNumRequeues"),
+ MSG_CONTENT((short)5, "msgContent");
+
+ 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: // QUEUE_ID
+ return QUEUE_ID;
+ case 2: // MSG_ORG_TIMESTAMP
+ return MSG_ORG_TIMESTAMP;
+ case 3: // MSG_TIMESTAMP
+ return MSG_TIMESTAMP;
+ case 4: // MSG_NUM_REQUEUES
+ return MSG_NUM_REQUEUES;
+ case 5: // MSG_CONTENT
+ return MSG_CONTENT;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches 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 __QUEUEID_ISSET_ID = 0;
+ private static final int __MSGORGTIMESTAMP_ISSET_ID = 1;
+ private static final int __MSGTIMESTAMP_ISSET_ID = 2;
+ private static final int __MSGNUMREQUEUES_ISSET_ID = 3;
+ 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.QUEUE_ID, new org.apache.thrift.meta_data.FieldMetaData("queueId", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+ tmpMap.put(_Fields.MSG_ORG_TIMESTAMP, new org.apache.thrift.meta_data.FieldMetaData("msgOrgTimestamp", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+ tmpMap.put(_Fields.MSG_TIMESTAMP, new org.apache.thrift.meta_data.FieldMetaData("msgTimestamp", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+ tmpMap.put(_Fields.MSG_NUM_REQUEUES, new org.apache.thrift.meta_data.FieldMetaData("msgNumRequeues", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+ tmpMap.put(_Fields.MSG_CONTENT, new org.apache.thrift.meta_data.FieldMetaData("msgContent", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TQueueMessage.class, metaDataMap);
+ }
+
+ public TQueueMessage() {
+ this.queueId = 0L;
+
+ this.msgOrgTimestamp = 0L;
+
+ this.msgTimestamp = 0L;
+
+ this.msgNumRequeues = 0;
+
+ }
+
+ public TQueueMessage(
+ long queueId,
+ long msgOrgTimestamp,
+ long msgTimestamp,
+ int msgNumRequeues,
+ ByteBuffer msgContent)
+ {
+ this();
+ this.queueId = queueId;
+ setQueueIdIsSet(true);
+ this.msgOrgTimestamp = msgOrgTimestamp;
+ setMsgOrgTimestampIsSet(true);
+ this.msgTimestamp = msgTimestamp;
+ setMsgTimestampIsSet(true);
+ this.msgNumRequeues = msgNumRequeues;
+ setMsgNumRequeuesIsSet(true);
+ this.msgContent = msgContent;
+ }
+
+ /**
+ * Performs a deep copy on other.
+ */
+ public TQueueMessage(TQueueMessage other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.queueId = other.queueId;
+ this.msgOrgTimestamp = other.msgOrgTimestamp;
+ this.msgTimestamp = other.msgTimestamp;
+ this.msgNumRequeues = other.msgNumRequeues;
+ if (other.isSetMsgContent()) {
+ this.msgContent = org.apache.thrift.TBaseHelper.copyBinary(other.msgContent);
+;
+ }
+ }
+
+ public TQueueMessage deepCopy() {
+ return new TQueueMessage(this);
+ }
+
+ @Override
+ public void clear() {
+ this.queueId = 0L;
+
+ this.msgOrgTimestamp = 0L;
+
+ this.msgTimestamp = 0L;
+
+ this.msgNumRequeues = 0;
+
+ this.msgContent = null;
+ }
+
+ public long getQueueId() {
+ return this.queueId;
+ }
+
+ public TQueueMessage setQueueId(long queueId) {
+ this.queueId = queueId;
+ setQueueIdIsSet(true);
+ return this;
+ }
+
+ public void unsetQueueId() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __QUEUEID_ISSET_ID);
+ }
+
+ /** Returns true if field queueId is set (has been assigned a value) and false otherwise */
+ public boolean isSetQueueId() {
+ return EncodingUtils.testBit(__isset_bitfield, __QUEUEID_ISSET_ID);
+ }
+
+ public void setQueueIdIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __QUEUEID_ISSET_ID, value);
+ }
+
+ public long getMsgOrgTimestamp() {
+ return this.msgOrgTimestamp;
+ }
+
+ public TQueueMessage setMsgOrgTimestamp(long msgOrgTimestamp) {
+ this.msgOrgTimestamp = msgOrgTimestamp;
+ setMsgOrgTimestampIsSet(true);
+ return this;
+ }
+
+ public void unsetMsgOrgTimestamp() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MSGORGTIMESTAMP_ISSET_ID);
+ }
+
+ /** Returns true if field msgOrgTimestamp is set (has been assigned a value) and false otherwise */
+ public boolean isSetMsgOrgTimestamp() {
+ return EncodingUtils.testBit(__isset_bitfield, __MSGORGTIMESTAMP_ISSET_ID);
+ }
+
+ public void setMsgOrgTimestampIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MSGORGTIMESTAMP_ISSET_ID, value);
+ }
+
+ public long getMsgTimestamp() {
+ return this.msgTimestamp;
+ }
+
+ public TQueueMessage setMsgTimestamp(long msgTimestamp) {
+ this.msgTimestamp = msgTimestamp;
+ setMsgTimestampIsSet(true);
+ return this;
+ }
+
+ public void unsetMsgTimestamp() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MSGTIMESTAMP_ISSET_ID);
+ }
+
+ /** Returns true if field msgTimestamp is set (has been assigned a value) and false otherwise */
+ public boolean isSetMsgTimestamp() {
+ return EncodingUtils.testBit(__isset_bitfield, __MSGTIMESTAMP_ISSET_ID);
+ }
+
+ public void setMsgTimestampIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MSGTIMESTAMP_ISSET_ID, value);
+ }
+
+ public int getMsgNumRequeues() {
+ return this.msgNumRequeues;
+ }
+
+ public TQueueMessage setMsgNumRequeues(int msgNumRequeues) {
+ this.msgNumRequeues = msgNumRequeues;
+ setMsgNumRequeuesIsSet(true);
+ return this;
+ }
+
+ public void unsetMsgNumRequeues() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MSGNUMREQUEUES_ISSET_ID);
+ }
+
+ /** Returns true if field msgNumRequeues is set (has been assigned a value) and false otherwise */
+ public boolean isSetMsgNumRequeues() {
+ return EncodingUtils.testBit(__isset_bitfield, __MSGNUMREQUEUES_ISSET_ID);
+ }
+
+ public void setMsgNumRequeuesIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MSGNUMREQUEUES_ISSET_ID, value);
+ }
+
+ public byte[] getMsgContent() {
+ setMsgContent(org.apache.thrift.TBaseHelper.rightSize(msgContent));
+ return msgContent == null ? null : msgContent.array();
+ }
+
+ public ByteBuffer bufferForMsgContent() {
+ return msgContent;
+ }
+
+ public TQueueMessage setMsgContent(byte[] msgContent) {
+ setMsgContent(msgContent == null ? (ByteBuffer)null : ByteBuffer.wrap(msgContent));
+ return this;
+ }
+
+ public TQueueMessage setMsgContent(ByteBuffer msgContent) {
+ this.msgContent = msgContent;
+ return this;
+ }
+
+ public void unsetMsgContent() {
+ this.msgContent = null;
+ }
+
+ /** Returns true if field msgContent is set (has been assigned a value) and false otherwise */
+ public boolean isSetMsgContent() {
+ return this.msgContent != null;
+ }
+
+ public void setMsgContentIsSet(boolean value) {
+ if (!value) {
+ this.msgContent = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case QUEUE_ID:
+ if (value == null) {
+ unsetQueueId();
+ } else {
+ setQueueId((Long)value);
+ }
+ break;
+
+ case MSG_ORG_TIMESTAMP:
+ if (value == null) {
+ unsetMsgOrgTimestamp();
+ } else {
+ setMsgOrgTimestamp((Long)value);
+ }
+ break;
+
+ case MSG_TIMESTAMP:
+ if (value == null) {
+ unsetMsgTimestamp();
+ } else {
+ setMsgTimestamp((Long)value);
+ }
+ break;
+
+ case MSG_NUM_REQUEUES:
+ if (value == null) {
+ unsetMsgNumRequeues();
+ } else {
+ setMsgNumRequeues((Integer)value);
+ }
+ break;
+
+ case MSG_CONTENT:
+ if (value == null) {
+ unsetMsgContent();
+ } else {
+ setMsgContent((ByteBuffer)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case QUEUE_ID:
+ return Long.valueOf(getQueueId());
+
+ case MSG_ORG_TIMESTAMP:
+ return Long.valueOf(getMsgOrgTimestamp());
+
+ case MSG_TIMESTAMP:
+ return Long.valueOf(getMsgTimestamp());
+
+ case MSG_NUM_REQUEUES:
+ return Integer.valueOf(getMsgNumRequeues());
+
+ case MSG_CONTENT:
+ return getMsgContent();
+
+ }
+ 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 QUEUE_ID:
+ return isSetQueueId();
+ case MSG_ORG_TIMESTAMP:
+ return isSetMsgOrgTimestamp();
+ case MSG_TIMESTAMP:
+ return isSetMsgTimestamp();
+ case MSG_NUM_REQUEUES:
+ return isSetMsgNumRequeues();
+ case MSG_CONTENT:
+ return isSetMsgContent();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TQueueMessage)
+ return this.equals((TQueueMessage)that);
+ return false;
+ }
+
+ public boolean equals(TQueueMessage that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_queueId = true;
+ boolean that_present_queueId = true;
+ if (this_present_queueId || that_present_queueId) {
+ if (!(this_present_queueId && that_present_queueId))
+ return false;
+ if (this.queueId != that.queueId)
+ return false;
+ }
+
+ boolean this_present_msgOrgTimestamp = true;
+ boolean that_present_msgOrgTimestamp = true;
+ if (this_present_msgOrgTimestamp || that_present_msgOrgTimestamp) {
+ if (!(this_present_msgOrgTimestamp && that_present_msgOrgTimestamp))
+ return false;
+ if (this.msgOrgTimestamp != that.msgOrgTimestamp)
+ return false;
+ }
+
+ boolean this_present_msgTimestamp = true;
+ boolean that_present_msgTimestamp = true;
+ if (this_present_msgTimestamp || that_present_msgTimestamp) {
+ if (!(this_present_msgTimestamp && that_present_msgTimestamp))
+ return false;
+ if (this.msgTimestamp != that.msgTimestamp)
+ return false;
+ }
+
+ boolean this_present_msgNumRequeues = true;
+ boolean that_present_msgNumRequeues = true;
+ if (this_present_msgNumRequeues || that_present_msgNumRequeues) {
+ if (!(this_present_msgNumRequeues && that_present_msgNumRequeues))
+ return false;
+ if (this.msgNumRequeues != that.msgNumRequeues)
+ return false;
+ }
+
+ boolean this_present_msgContent = true && this.isSetMsgContent();
+ boolean that_present_msgContent = true && that.isSetMsgContent();
+ if (this_present_msgContent || that_present_msgContent) {
+ if (!(this_present_msgContent && that_present_msgContent))
+ return false;
+ if (!this.msgContent.equals(that.msgContent))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public int compareTo(TQueueMessage other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(isSetQueueId()).compareTo(other.isSetQueueId());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetQueueId()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.queueId, other.queueId);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetMsgOrgTimestamp()).compareTo(other.isSetMsgOrgTimestamp());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetMsgOrgTimestamp()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.msgOrgTimestamp, other.msgOrgTimestamp);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetMsgTimestamp()).compareTo(other.isSetMsgTimestamp());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetMsgTimestamp()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.msgTimestamp, other.msgTimestamp);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetMsgNumRequeues()).compareTo(other.isSetMsgNumRequeues());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetMsgNumRequeues()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.msgNumRequeues, other.msgNumRequeues);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetMsgContent()).compareTo(other.isSetMsgContent());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetMsgContent()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.msgContent, other.msgContent);
+ 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("TQueueMessage(");
+ boolean first = true;
+
+ sb.append("queueId:");
+ sb.append(this.queueId);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("msgOrgTimestamp:");
+ sb.append(this.msgOrgTimestamp);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("msgTimestamp:");
+ sb.append(this.msgTimestamp);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("msgNumRequeues:");
+ sb.append(this.msgNumRequeues);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("msgContent:");
+ if (this.msgContent == null) {
+ sb.append("null");
+ } else {
+ org.apache.thrift.TBaseHelper.toString(this.msgContent, sb);
+ }
+ 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 TQueueMessageStandardSchemeFactory implements SchemeFactory {
+ public TQueueMessageStandardScheme getScheme() {
+ return new TQueueMessageStandardScheme();
+ }
+ }
+
+ private static class TQueueMessageStandardScheme extends StandardScheme {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TQueueMessage struct) throws org.apache.thrift.TException {
+ org.apache.thrift.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: // QUEUE_ID
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.queueId = iprot.readI64();
+ struct.setQueueIdIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // MSG_ORG_TIMESTAMP
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.msgOrgTimestamp = iprot.readI64();
+ struct.setMsgOrgTimestampIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // MSG_TIMESTAMP
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.msgTimestamp = iprot.readI64();
+ struct.setMsgTimestampIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // MSG_NUM_REQUEUES
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.msgNumRequeues = iprot.readI32();
+ struct.setMsgNumRequeuesIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 5: // MSG_CONTENT
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.msgContent = iprot.readBinary();
+ struct.setMsgContentIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, TQueueMessage struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(QUEUE_ID_FIELD_DESC);
+ oprot.writeI64(struct.queueId);
+ oprot.writeFieldEnd();
+ oprot.writeFieldBegin(MSG_ORG_TIMESTAMP_FIELD_DESC);
+ oprot.writeI64(struct.msgOrgTimestamp);
+ oprot.writeFieldEnd();
+ oprot.writeFieldBegin(MSG_TIMESTAMP_FIELD_DESC);
+ oprot.writeI64(struct.msgTimestamp);
+ oprot.writeFieldEnd();
+ oprot.writeFieldBegin(MSG_NUM_REQUEUES_FIELD_DESC);
+ oprot.writeI32(struct.msgNumRequeues);
+ oprot.writeFieldEnd();
+ if (struct.msgContent != null) {
+ oprot.writeFieldBegin(MSG_CONTENT_FIELD_DESC);
+ oprot.writeBinary(struct.msgContent);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TQueueMessageTupleSchemeFactory implements SchemeFactory {
+ public TQueueMessageTupleScheme getScheme() {
+ return new TQueueMessageTupleScheme();
+ }
+ }
+
+ private static class TQueueMessageTupleScheme extends TupleScheme {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TQueueMessage struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetQueueId()) {
+ optionals.set(0);
+ }
+ if (struct.isSetMsgOrgTimestamp()) {
+ optionals.set(1);
+ }
+ if (struct.isSetMsgTimestamp()) {
+ optionals.set(2);
+ }
+ if (struct.isSetMsgNumRequeues()) {
+ optionals.set(3);
+ }
+ if (struct.isSetMsgContent()) {
+ optionals.set(4);
+ }
+ oprot.writeBitSet(optionals, 5);
+ if (struct.isSetQueueId()) {
+ oprot.writeI64(struct.queueId);
+ }
+ if (struct.isSetMsgOrgTimestamp()) {
+ oprot.writeI64(struct.msgOrgTimestamp);
+ }
+ if (struct.isSetMsgTimestamp()) {
+ oprot.writeI64(struct.msgTimestamp);
+ }
+ if (struct.isSetMsgNumRequeues()) {
+ oprot.writeI32(struct.msgNumRequeues);
+ }
+ if (struct.isSetMsgContent()) {
+ oprot.writeBinary(struct.msgContent);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TQueueMessage struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(5);
+ if (incoming.get(0)) {
+ struct.queueId = iprot.readI64();
+ struct.setQueueIdIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.msgOrgTimestamp = iprot.readI64();
+ struct.setMsgOrgTimestampIsSet(true);
+ }
+ if (incoming.get(2)) {
+ struct.msgTimestamp = iprot.readI64();
+ struct.setMsgTimestampIsSet(true);
+ }
+ if (incoming.get(3)) {
+ struct.msgNumRequeues = iprot.readI32();
+ struct.setMsgNumRequeuesIsSet(true);
+ }
+ if (incoming.get(4)) {
+ struct.msgContent = iprot.readBinary();
+ struct.setMsgContentIsSet(true);
+ }
+ }
+ }
+
+}
+
diff --git a/src/main/java/com/github/btnguyen2k/queueserver/thrift/TQueueResponse.java b/src/main/java/com/github/btnguyen2k/queueserver/thrift/TQueueResponse.java
new file mode 100644
index 0000000..a034318
--- /dev/null
+++ b/src/main/java/com/github/btnguyen2k/queueserver/thrift/TQueueResponse.java
@@ -0,0 +1,685 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.1)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package com.github.btnguyen2k.queueserver.thrift;
+
+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.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TQueueResponse implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TQueueResponse");
+
+ private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.I32, (short)1);
+ private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField RESULT_FIELD_DESC = new org.apache.thrift.protocol.TField("result", org.apache.thrift.protocol.TType.BOOL, (short)3);
+ private static final org.apache.thrift.protocol.TField QUEUE_MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("queueMessage", org.apache.thrift.protocol.TType.STRUCT, (short)4);
+
+ private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new TQueueResponseStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new TQueueResponseTupleSchemeFactory());
+ }
+
+ public int status; // required
+ public String message; // required
+ public boolean result; // required
+ public TQueueMessage queueMessage; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ STATUS((short)1, "status"),
+ MESSAGE((short)2, "message"),
+ RESULT((short)3, "result"),
+ QUEUE_MESSAGE((short)4, "queueMessage");
+
+ 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: // STATUS
+ return STATUS;
+ case 2: // MESSAGE
+ return MESSAGE;
+ case 3: // RESULT
+ return RESULT;
+ case 4: // QUEUE_MESSAGE
+ return QUEUE_MESSAGE;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches 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 __STATUS_ISSET_ID = 0;
+ private static final int __RESULT_ISSET_ID = 1;
+ 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.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+ tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.RESULT, new org.apache.thrift.meta_data.FieldMetaData("result", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
+ tmpMap.put(_Fields.QUEUE_MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("queueMessage", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TQueueMessage.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TQueueResponse.class, metaDataMap);
+ }
+
+ public TQueueResponse() {
+ }
+
+ public TQueueResponse(
+ int status,
+ String message,
+ boolean result,
+ TQueueMessage queueMessage)
+ {
+ this();
+ this.status = status;
+ setStatusIsSet(true);
+ this.message = message;
+ this.result = result;
+ setResultIsSet(true);
+ this.queueMessage = queueMessage;
+ }
+
+ /**
+ * Performs a deep copy on other.
+ */
+ public TQueueResponse(TQueueResponse other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.status = other.status;
+ if (other.isSetMessage()) {
+ this.message = other.message;
+ }
+ this.result = other.result;
+ if (other.isSetQueueMessage()) {
+ this.queueMessage = new TQueueMessage(other.queueMessage);
+ }
+ }
+
+ public TQueueResponse deepCopy() {
+ return new TQueueResponse(this);
+ }
+
+ @Override
+ public void clear() {
+ setStatusIsSet(false);
+ this.status = 0;
+ this.message = null;
+ setResultIsSet(false);
+ this.result = false;
+ this.queueMessage = null;
+ }
+
+ public int getStatus() {
+ return this.status;
+ }
+
+ public TQueueResponse setStatus(int status) {
+ this.status = status;
+ setStatusIsSet(true);
+ return this;
+ }
+
+ public void unsetStatus() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __STATUS_ISSET_ID);
+ }
+
+ /** Returns true if field status is set (has been assigned a value) and false otherwise */
+ public boolean isSetStatus() {
+ return EncodingUtils.testBit(__isset_bitfield, __STATUS_ISSET_ID);
+ }
+
+ public void setStatusIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __STATUS_ISSET_ID, value);
+ }
+
+ public String getMessage() {
+ return this.message;
+ }
+
+ public TQueueResponse setMessage(String message) {
+ this.message = message;
+ return this;
+ }
+
+ public void unsetMessage() {
+ this.message = null;
+ }
+
+ /** Returns true if field message is set (has been assigned a value) and false otherwise */
+ public boolean isSetMessage() {
+ return this.message != null;
+ }
+
+ public void setMessageIsSet(boolean value) {
+ if (!value) {
+ this.message = null;
+ }
+ }
+
+ public boolean isResult() {
+ return this.result;
+ }
+
+ public TQueueResponse setResult(boolean result) {
+ this.result = result;
+ setResultIsSet(true);
+ return this;
+ }
+
+ public void unsetResult() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __RESULT_ISSET_ID);
+ }
+
+ /** Returns true if field result is set (has been assigned a value) and false otherwise */
+ public boolean isSetResult() {
+ return EncodingUtils.testBit(__isset_bitfield, __RESULT_ISSET_ID);
+ }
+
+ public void setResultIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __RESULT_ISSET_ID, value);
+ }
+
+ public TQueueMessage getQueueMessage() {
+ return this.queueMessage;
+ }
+
+ public TQueueResponse setQueueMessage(TQueueMessage queueMessage) {
+ this.queueMessage = queueMessage;
+ return this;
+ }
+
+ public void unsetQueueMessage() {
+ this.queueMessage = null;
+ }
+
+ /** Returns true if field queueMessage is set (has been assigned a value) and false otherwise */
+ public boolean isSetQueueMessage() {
+ return this.queueMessage != null;
+ }
+
+ public void setQueueMessageIsSet(boolean value) {
+ if (!value) {
+ this.queueMessage = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case STATUS:
+ if (value == null) {
+ unsetStatus();
+ } else {
+ setStatus((Integer)value);
+ }
+ break;
+
+ case MESSAGE:
+ if (value == null) {
+ unsetMessage();
+ } else {
+ setMessage((String)value);
+ }
+ break;
+
+ case RESULT:
+ if (value == null) {
+ unsetResult();
+ } else {
+ setResult((Boolean)value);
+ }
+ break;
+
+ case QUEUE_MESSAGE:
+ if (value == null) {
+ unsetQueueMessage();
+ } else {
+ setQueueMessage((TQueueMessage)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case STATUS:
+ return Integer.valueOf(getStatus());
+
+ case MESSAGE:
+ return getMessage();
+
+ case RESULT:
+ return Boolean.valueOf(isResult());
+
+ case QUEUE_MESSAGE:
+ return getQueueMessage();
+
+ }
+ 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 STATUS:
+ return isSetStatus();
+ case MESSAGE:
+ return isSetMessage();
+ case RESULT:
+ return isSetResult();
+ case QUEUE_MESSAGE:
+ return isSetQueueMessage();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof TQueueResponse)
+ return this.equals((TQueueResponse)that);
+ return false;
+ }
+
+ public boolean equals(TQueueResponse that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_status = true;
+ boolean that_present_status = true;
+ if (this_present_status || that_present_status) {
+ if (!(this_present_status && that_present_status))
+ return false;
+ if (this.status != that.status)
+ return false;
+ }
+
+ boolean this_present_message = true && this.isSetMessage();
+ boolean that_present_message = true && that.isSetMessage();
+ if (this_present_message || that_present_message) {
+ if (!(this_present_message && that_present_message))
+ return false;
+ if (!this.message.equals(that.message))
+ return false;
+ }
+
+ boolean this_present_result = true;
+ boolean that_present_result = true;
+ if (this_present_result || that_present_result) {
+ if (!(this_present_result && that_present_result))
+ return false;
+ if (this.result != that.result)
+ return false;
+ }
+
+ boolean this_present_queueMessage = true && this.isSetQueueMessage();
+ boolean that_present_queueMessage = true && that.isSetQueueMessage();
+ if (this_present_queueMessage || that_present_queueMessage) {
+ if (!(this_present_queueMessage && that_present_queueMessage))
+ return false;
+ if (!this.queueMessage.equals(that.queueMessage))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public int compareTo(TQueueResponse other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(isSetStatus()).compareTo(other.isSetStatus());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetStatus()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, other.status);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetMessage()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetResult()).compareTo(other.isSetResult());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetResult()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.result, other.result);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetQueueMessage()).compareTo(other.isSetQueueMessage());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetQueueMessage()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.queueMessage, other.queueMessage);
+ 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("TQueueResponse(");
+ boolean first = true;
+
+ sb.append("status:");
+ sb.append(this.status);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("message:");
+ if (this.message == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.message);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("result:");
+ sb.append(this.result);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("queueMessage:");
+ if (this.queueMessage == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.queueMessage);
+ }
+ 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 (queueMessage != null) {
+ queueMessage.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 {
+ // 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 TQueueResponseStandardSchemeFactory implements SchemeFactory {
+ public TQueueResponseStandardScheme getScheme() {
+ return new TQueueResponseStandardScheme();
+ }
+ }
+
+ private static class TQueueResponseStandardScheme extends StandardScheme {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, TQueueResponse struct) throws org.apache.thrift.TException {
+ org.apache.thrift.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: // STATUS
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.status = iprot.readI32();
+ struct.setStatusIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // MESSAGE
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.message = iprot.readString();
+ struct.setMessageIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // RESULT
+ if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+ struct.result = iprot.readBool();
+ struct.setResultIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // QUEUE_MESSAGE
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.queueMessage = new TQueueMessage();
+ struct.queueMessage.read(iprot);
+ struct.setQueueMessageIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, TQueueResponse struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(STATUS_FIELD_DESC);
+ oprot.writeI32(struct.status);
+ oprot.writeFieldEnd();
+ if (struct.message != null) {
+ oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
+ oprot.writeString(struct.message);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldBegin(RESULT_FIELD_DESC);
+ oprot.writeBool(struct.result);
+ oprot.writeFieldEnd();
+ if (struct.queueMessage != null) {
+ oprot.writeFieldBegin(QUEUE_MESSAGE_FIELD_DESC);
+ struct.queueMessage.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class TQueueResponseTupleSchemeFactory implements SchemeFactory {
+ public TQueueResponseTupleScheme getScheme() {
+ return new TQueueResponseTupleScheme();
+ }
+ }
+
+ private static class TQueueResponseTupleScheme extends TupleScheme {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, TQueueResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSetStatus()) {
+ optionals.set(0);
+ }
+ if (struct.isSetMessage()) {
+ optionals.set(1);
+ }
+ if (struct.isSetResult()) {
+ optionals.set(2);
+ }
+ if (struct.isSetQueueMessage()) {
+ optionals.set(3);
+ }
+ oprot.writeBitSet(optionals, 4);
+ if (struct.isSetStatus()) {
+ oprot.writeI32(struct.status);
+ }
+ if (struct.isSetMessage()) {
+ oprot.writeString(struct.message);
+ }
+ if (struct.isSetResult()) {
+ oprot.writeBool(struct.result);
+ }
+ if (struct.isSetQueueMessage()) {
+ struct.queueMessage.write(oprot);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, TQueueResponse struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(4);
+ if (incoming.get(0)) {
+ struct.status = iprot.readI32();
+ struct.setStatusIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.message = iprot.readString();
+ struct.setMessageIsSet(true);
+ }
+ if (incoming.get(2)) {
+ struct.result = iprot.readBool();
+ struct.setResultIsSet(true);
+ }
+ if (incoming.get(3)) {
+ struct.queueMessage = new TQueueMessage();
+ struct.queueMessage.read(iprot);
+ struct.setQueueMessageIsSet(true);
+ }
+ }
+ }
+
+}
+
diff --git a/src/main/java/com/github/btnguyen2k/queueserver/thrift/TQueueService.java b/src/main/java/com/github/btnguyen2k/queueserver/thrift/TQueueService.java
new file mode 100644
index 0000000..110bf08
--- /dev/null
+++ b/src/main/java/com/github/btnguyen2k/queueserver/thrift/TQueueService.java
@@ -0,0 +1,10266 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.1)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+package com.github.btnguyen2k.queueserver.thrift;
+
+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.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TQueueService {
+
+ public interface Iface {
+
+ /**
+ * "Ping" the server. This method is to test if server is reachable.
+ */
+ public void ping() throws org.apache.thrift.TException;
+
+ /**
+ * "Ping" the server. This method is to test if server is reachable.
+ */
+ public boolean ping2() throws org.apache.thrift.TException;
+
+ /**
+ * Checks if a queue exists.
+ *
+ * @param _secret
+ * @param _queueName
+ * @return {@code status == 200} if queue exists, {@code status == 404} otherwise; {@code status == 500} means "exception/error on server"
+ *
+ * @param _secret
+ * @param _queueName
+ */
+ public TQueueResponse queueExists(String _secret, String _queueName) throws org.apache.thrift.TException;
+
+ /**
+ * Creates & Initializes a new queue.
+ *
+ * @param _secret
+ * @param _queueName
+ * @return {@code status == 200} if successful; {@code status == 500} means "exception/error on server"
+ *
+ * @param _secret
+ * @param _queueName
+ */
+ public TQueueResponse initQueue(String _secret, String _queueName) throws org.apache.thrift.TException;
+
+ /**
+ * Puts a message to a queue.
+ *
+ * @param _secret
+ * @param _queueName
+ * @param _message
+ * @return {@code status == 200} if successful, {@code status == 404} if queue does not exist; {@code status == 500} means "exception/error on server"
+ *
+ * @param _secret
+ * @param _queueName
+ * @param _message
+ */
+ public TQueueResponse queue(String _secret, String _queueName, TQueueMessage _message) throws org.apache.thrift.TException;
+
+ /**
+ * Re-queues a message.
+ *
+ * @param _secret
+ * @param _queueName
+ * @param _message
+ * @return {@code status == 200} if successful, {@code status == 404} if queue does not exist; {@code status == 500} means "exception/error on server"
+ *
+ * @param _secret
+ * @param _queueName
+ * @param _message
+ */
+ public TQueueResponse requeue(String _secret, String _queueName, TQueueMessage _message) throws org.apache.thrift.TException;
+
+ /**
+ * Re-queues a message "silently".
+ *
+ * @param _secret
+ * @param _queueName
+ * @param _message
+ * @return {@code status == 200} if successful, {@code status == 404} if queue does not exist; {@code status == 500} means "exception/error on server"
+ *
+ * @param _secret
+ * @param _queueName
+ * @param _message
+ */
+ public TQueueResponse requeueSilent(String _secret, String _queueName, TQueueMessage _message) throws org.apache.thrift.TException;
+
+ /**
+ * Called when finish processing the message to cleanup ephemeral storage.
+ *
+ * @param _secret
+ * @param _queueName
+ * @param _message
+ * @return {@code status == 200} if successful, {@code status == 404} if queue does not exist; {@code status == 500} means "exception/error on server"
+ *
+ * @param _secret
+ * @param _queueName
+ * @param _message
+ */
+ public TQueueResponse finish(String _secret, String _queueName, TQueueMessage _message) throws org.apache.thrift.TException;
+
+ /**
+ * Takes a message from a queue.
+ *
+ * @param _secret
+ * @param _queueName
+ * @return {@code status == 200} if successful, {@code status == 404} if queue does not exist; {@code status == 500} means "exception/error on server"
+ *
+ * @param _secret
+ * @param _queueName
+ */
+ public TQueueResponse take(String _secret, String _queueName) throws org.apache.thrift.TException;
+
+ /**
+ * Gets number of items currently in a queue.
+ *
+ * @param _secret
+ * @param _queueName
+ * @return {@code status == 200} if successful, {@code status == 404} if queue does not exist; {@code status == 500} means "exception/error on server"
+ *
+ * @param _secret
+ * @param _queueName
+ */
+ public TQueueSizeResponse queueSize(String _secret, String _queueName) throws org.apache.thrift.TException;
+
+ /**
+ * Gets number of items currently in a queue's ephemeral storage.
+ *
+ * @param _secret
+ * @param _queueName
+ * @return {@code status == 200} if successful, {@code status == 404} if queue does not exist; {@code status == 500} means "exception/error on server"
+ *
+ * @param _secret
+ * @param _queueName
+ */
+ public TQueueSizeResponse ephemeralSize(String _secret, String _queueName) throws org.apache.thrift.TException;
+
+ }
+
+ public interface AsyncIface {
+
+ public void ping(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+ public void ping2(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+ public void queueExists(String _secret, String _queueName, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+ public void initQueue(String _secret, String _queueName, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+ public void queue(String _secret, String _queueName, TQueueMessage _message, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+ public void requeue(String _secret, String _queueName, TQueueMessage _message, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+ public void requeueSilent(String _secret, String _queueName, TQueueMessage _message, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+ public void finish(String _secret, String _queueName, TQueueMessage _message, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+ public void take(String _secret, String _queueName, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+ public void queueSize(String _secret, String _queueName, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
+ public void ephemeralSize(String _secret, String _queueName, 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 void ping() throws org.apache.thrift.TException
+ {
+ send_ping();
+ }
+
+ public void send_ping() throws org.apache.thrift.TException
+ {
+ ping_args args = new ping_args();
+ sendBase("ping", args);
+ }
+
+ public boolean ping2() throws org.apache.thrift.TException
+ {
+ send_ping2();
+ return recv_ping2();
+ }
+
+ public void send_ping2() throws org.apache.thrift.TException
+ {
+ ping2_args args = new ping2_args();
+ sendBase("ping2", args);
+ }
+
+ public boolean recv_ping2() throws org.apache.thrift.TException
+ {
+ ping2_result result = new ping2_result();
+ receiveBase(result, "ping2");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "ping2 failed: unknown result");
+ }
+
+ public TQueueResponse queueExists(String _secret, String _queueName) throws org.apache.thrift.TException
+ {
+ send_queueExists(_secret, _queueName);
+ return recv_queueExists();
+ }
+
+ public void send_queueExists(String _secret, String _queueName) throws org.apache.thrift.TException
+ {
+ queueExists_args args = new queueExists_args();
+ args.set_secret(_secret);
+ args.set_queueName(_queueName);
+ sendBase("queueExists", args);
+ }
+
+ public TQueueResponse recv_queueExists() throws org.apache.thrift.TException
+ {
+ queueExists_result result = new queueExists_result();
+ receiveBase(result, "queueExists");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "queueExists failed: unknown result");
+ }
+
+ public TQueueResponse initQueue(String _secret, String _queueName) throws org.apache.thrift.TException
+ {
+ send_initQueue(_secret, _queueName);
+ return recv_initQueue();
+ }
+
+ public void send_initQueue(String _secret, String _queueName) throws org.apache.thrift.TException
+ {
+ initQueue_args args = new initQueue_args();
+ args.set_secret(_secret);
+ args.set_queueName(_queueName);
+ sendBase("initQueue", args);
+ }
+
+ public TQueueResponse recv_initQueue() throws org.apache.thrift.TException
+ {
+ initQueue_result result = new initQueue_result();
+ receiveBase(result, "initQueue");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "initQueue failed: unknown result");
+ }
+
+ public TQueueResponse queue(String _secret, String _queueName, TQueueMessage _message) throws org.apache.thrift.TException
+ {
+ send_queue(_secret, _queueName, _message);
+ return recv_queue();
+ }
+
+ public void send_queue(String _secret, String _queueName, TQueueMessage _message) throws org.apache.thrift.TException
+ {
+ queue_args args = new queue_args();
+ args.set_secret(_secret);
+ args.set_queueName(_queueName);
+ args.set_message(_message);
+ sendBase("queue", args);
+ }
+
+ public TQueueResponse recv_queue() throws org.apache.thrift.TException
+ {
+ queue_result result = new queue_result();
+ receiveBase(result, "queue");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "queue failed: unknown result");
+ }
+
+ public TQueueResponse requeue(String _secret, String _queueName, TQueueMessage _message) throws org.apache.thrift.TException
+ {
+ send_requeue(_secret, _queueName, _message);
+ return recv_requeue();
+ }
+
+ public void send_requeue(String _secret, String _queueName, TQueueMessage _message) throws org.apache.thrift.TException
+ {
+ requeue_args args = new requeue_args();
+ args.set_secret(_secret);
+ args.set_queueName(_queueName);
+ args.set_message(_message);
+ sendBase("requeue", args);
+ }
+
+ public TQueueResponse recv_requeue() throws org.apache.thrift.TException
+ {
+ requeue_result result = new requeue_result();
+ receiveBase(result, "requeue");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "requeue failed: unknown result");
+ }
+
+ public TQueueResponse requeueSilent(String _secret, String _queueName, TQueueMessage _message) throws org.apache.thrift.TException
+ {
+ send_requeueSilent(_secret, _queueName, _message);
+ return recv_requeueSilent();
+ }
+
+ public void send_requeueSilent(String _secret, String _queueName, TQueueMessage _message) throws org.apache.thrift.TException
+ {
+ requeueSilent_args args = new requeueSilent_args();
+ args.set_secret(_secret);
+ args.set_queueName(_queueName);
+ args.set_message(_message);
+ sendBase("requeueSilent", args);
+ }
+
+ public TQueueResponse recv_requeueSilent() throws org.apache.thrift.TException
+ {
+ requeueSilent_result result = new requeueSilent_result();
+ receiveBase(result, "requeueSilent");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "requeueSilent failed: unknown result");
+ }
+
+ public TQueueResponse finish(String _secret, String _queueName, TQueueMessage _message) throws org.apache.thrift.TException
+ {
+ send_finish(_secret, _queueName, _message);
+ return recv_finish();
+ }
+
+ public void send_finish(String _secret, String _queueName, TQueueMessage _message) throws org.apache.thrift.TException
+ {
+ finish_args args = new finish_args();
+ args.set_secret(_secret);
+ args.set_queueName(_queueName);
+ args.set_message(_message);
+ sendBase("finish", args);
+ }
+
+ public TQueueResponse recv_finish() throws org.apache.thrift.TException
+ {
+ finish_result result = new finish_result();
+ receiveBase(result, "finish");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "finish failed: unknown result");
+ }
+
+ public TQueueResponse take(String _secret, String _queueName) throws org.apache.thrift.TException
+ {
+ send_take(_secret, _queueName);
+ return recv_take();
+ }
+
+ public void send_take(String _secret, String _queueName) throws org.apache.thrift.TException
+ {
+ take_args args = new take_args();
+ args.set_secret(_secret);
+ args.set_queueName(_queueName);
+ sendBase("take", args);
+ }
+
+ public TQueueResponse recv_take() throws org.apache.thrift.TException
+ {
+ take_result result = new take_result();
+ receiveBase(result, "take");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "take failed: unknown result");
+ }
+
+ public TQueueSizeResponse queueSize(String _secret, String _queueName) throws org.apache.thrift.TException
+ {
+ send_queueSize(_secret, _queueName);
+ return recv_queueSize();
+ }
+
+ public void send_queueSize(String _secret, String _queueName) throws org.apache.thrift.TException
+ {
+ queueSize_args args = new queueSize_args();
+ args.set_secret(_secret);
+ args.set_queueName(_queueName);
+ sendBase("queueSize", args);
+ }
+
+ public TQueueSizeResponse recv_queueSize() throws org.apache.thrift.TException
+ {
+ queueSize_result result = new queueSize_result();
+ receiveBase(result, "queueSize");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "queueSize failed: unknown result");
+ }
+
+ public TQueueSizeResponse ephemeralSize(String _secret, String _queueName) throws org.apache.thrift.TException
+ {
+ send_ephemeralSize(_secret, _queueName);
+ return recv_ephemeralSize();
+ }
+
+ public void send_ephemeralSize(String _secret, String _queueName) throws org.apache.thrift.TException
+ {
+ ephemeralSize_args args = new ephemeralSize_args();
+ args.set_secret(_secret);
+ args.set_queueName(_queueName);
+ sendBase("ephemeralSize", args);
+ }
+
+ public TQueueSizeResponse recv_ephemeralSize() throws org.apache.thrift.TException
+ {
+ ephemeralSize_result result = new ephemeralSize_result();
+ receiveBase(result, "ephemeralSize");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "ephemeralSize 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 ping(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ ping_call method_call = new ping_call(resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class ping_call extends org.apache.thrift.async.TAsyncMethodCall {
+ public ping_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("ping", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ ping_args args = new ping_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 ping2(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ ping2_call method_call = new ping2_call(resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class ping2_call extends org.apache.thrift.async.TAsyncMethodCall {
+ public ping2_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("ping2", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ ping2_args args = new ping2_args();
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public boolean 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_ping2();
+ }
+ }
+
+ public void queueExists(String _secret, String _queueName, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ queueExists_call method_call = new queueExists_call(_secret, _queueName, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class queueExists_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private String _secret;
+ private String _queueName;
+ public queueExists_call(String _secret, String _queueName, 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._secret = _secret;
+ this._queueName = _queueName;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("queueExists", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ queueExists_args args = new queueExists_args();
+ args.set_secret(_secret);
+ args.set_queueName(_queueName);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TQueueResponse 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_queueExists();
+ }
+ }
+
+ public void initQueue(String _secret, String _queueName, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ initQueue_call method_call = new initQueue_call(_secret, _queueName, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class initQueue_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private String _secret;
+ private String _queueName;
+ public initQueue_call(String _secret, String _queueName, 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._secret = _secret;
+ this._queueName = _queueName;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("initQueue", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ initQueue_args args = new initQueue_args();
+ args.set_secret(_secret);
+ args.set_queueName(_queueName);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TQueueResponse 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_initQueue();
+ }
+ }
+
+ public void queue(String _secret, String _queueName, TQueueMessage _message, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ queue_call method_call = new queue_call(_secret, _queueName, _message, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class queue_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private String _secret;
+ private String _queueName;
+ private TQueueMessage _message;
+ public queue_call(String _secret, String _queueName, TQueueMessage _message, 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._secret = _secret;
+ this._queueName = _queueName;
+ this._message = _message;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("queue", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ queue_args args = new queue_args();
+ args.set_secret(_secret);
+ args.set_queueName(_queueName);
+ args.set_message(_message);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TQueueResponse 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_queue();
+ }
+ }
+
+ public void requeue(String _secret, String _queueName, TQueueMessage _message, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ requeue_call method_call = new requeue_call(_secret, _queueName, _message, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class requeue_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private String _secret;
+ private String _queueName;
+ private TQueueMessage _message;
+ public requeue_call(String _secret, String _queueName, TQueueMessage _message, 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._secret = _secret;
+ this._queueName = _queueName;
+ this._message = _message;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("requeue", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ requeue_args args = new requeue_args();
+ args.set_secret(_secret);
+ args.set_queueName(_queueName);
+ args.set_message(_message);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TQueueResponse 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_requeue();
+ }
+ }
+
+ public void requeueSilent(String _secret, String _queueName, TQueueMessage _message, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ requeueSilent_call method_call = new requeueSilent_call(_secret, _queueName, _message, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class requeueSilent_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private String _secret;
+ private String _queueName;
+ private TQueueMessage _message;
+ public requeueSilent_call(String _secret, String _queueName, TQueueMessage _message, 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._secret = _secret;
+ this._queueName = _queueName;
+ this._message = _message;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("requeueSilent", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ requeueSilent_args args = new requeueSilent_args();
+ args.set_secret(_secret);
+ args.set_queueName(_queueName);
+ args.set_message(_message);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TQueueResponse 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_requeueSilent();
+ }
+ }
+
+ public void finish(String _secret, String _queueName, TQueueMessage _message, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ finish_call method_call = new finish_call(_secret, _queueName, _message, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class finish_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private String _secret;
+ private String _queueName;
+ private TQueueMessage _message;
+ public finish_call(String _secret, String _queueName, TQueueMessage _message, 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._secret = _secret;
+ this._queueName = _queueName;
+ this._message = _message;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("finish", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ finish_args args = new finish_args();
+ args.set_secret(_secret);
+ args.set_queueName(_queueName);
+ args.set_message(_message);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TQueueResponse 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_finish();
+ }
+ }
+
+ public void take(String _secret, String _queueName, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ take_call method_call = new take_call(_secret, _queueName, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class take_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private String _secret;
+ private String _queueName;
+ public take_call(String _secret, String _queueName, 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._secret = _secret;
+ this._queueName = _queueName;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("take", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ take_args args = new take_args();
+ args.set_secret(_secret);
+ args.set_queueName(_queueName);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TQueueResponse 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_take();
+ }
+ }
+
+ public void queueSize(String _secret, String _queueName, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ queueSize_call method_call = new queueSize_call(_secret, _queueName, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class queueSize_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private String _secret;
+ private String _queueName;
+ public queueSize_call(String _secret, String _queueName, 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._secret = _secret;
+ this._queueName = _queueName;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("queueSize", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ queueSize_args args = new queueSize_args();
+ args.set_secret(_secret);
+ args.set_queueName(_queueName);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TQueueSizeResponse 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_queueSize();
+ }
+ }
+
+ public void ephemeralSize(String _secret, String _queueName, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ ephemeralSize_call method_call = new ephemeralSize_call(_secret, _queueName, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class ephemeralSize_call extends org.apache.thrift.async.TAsyncMethodCall {
+ private String _secret;
+ private String _queueName;
+ public ephemeralSize_call(String _secret, String _queueName, 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._secret = _secret;
+ this._queueName = _queueName;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("ephemeralSize", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ ephemeralSize_args args = new ephemeralSize_args();
+ args.set_secret(_secret);
+ args.set_queueName(_queueName);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public TQueueSizeResponse 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_ephemeralSize();
+ }
+ }
+
+ }
+
+ 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>()));
+ }
+
+ protected Processor(I iface, Map> processMap) {
+ super(iface, getProcessMap(processMap));
+ }
+
+ private static Map> getProcessMap(Map> processMap) {
+ processMap.put("ping", new ping());
+ processMap.put("ping2", new ping2());
+ processMap.put("queueExists", new queueExists());
+ processMap.put("initQueue", new initQueue());
+ processMap.put("queue", new queue());
+ processMap.put("requeue", new requeue());
+ processMap.put("requeueSilent", new requeueSilent());
+ processMap.put("finish", new finish());
+ processMap.put("take", new take());
+ processMap.put("queueSize", new queueSize());
+ processMap.put("ephemeralSize", new ephemeralSize());
+ return processMap;
+ }
+
+ public static class ping extends org.apache.thrift.ProcessFunction {
+ public ping() {
+ super("ping");
+ }
+
+ public ping_args getEmptyArgsInstance() {
+ return new ping_args();
+ }
+
+ protected boolean isOneway() {
+ return true;
+ }
+
+ public org.apache.thrift.TBase getResult(I iface, ping_args args) throws org.apache.thrift.TException {
+ iface.ping();
+ return null;
+ }
+ }
+
+ public static class ping2 extends org.apache.thrift.ProcessFunction {
+ public ping2() {
+ super("ping2");
+ }
+
+ public ping2_args getEmptyArgsInstance() {
+ return new ping2_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public ping2_result getResult(I iface, ping2_args args) throws org.apache.thrift.TException {
+ ping2_result result = new ping2_result();
+ result.success = iface.ping2();
+ result.setSuccessIsSet(true);
+ return result;
+ }
+ }
+
+ public static class queueExists extends org.apache.thrift.ProcessFunction {
+ public queueExists() {
+ super("queueExists");
+ }
+
+ public queueExists_args getEmptyArgsInstance() {
+ return new queueExists_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public queueExists_result getResult(I iface, queueExists_args args) throws org.apache.thrift.TException {
+ queueExists_result result = new queueExists_result();
+ result.success = iface.queueExists(args._secret, args._queueName);
+ return result;
+ }
+ }
+
+ public static class initQueue extends org.apache.thrift.ProcessFunction {
+ public initQueue() {
+ super("initQueue");
+ }
+
+ public initQueue_args getEmptyArgsInstance() {
+ return new initQueue_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public initQueue_result getResult(I iface, initQueue_args args) throws org.apache.thrift.TException {
+ initQueue_result result = new initQueue_result();
+ result.success = iface.initQueue(args._secret, args._queueName);
+ return result;
+ }
+ }
+
+ public static class queue extends org.apache.thrift.ProcessFunction {
+ public queue() {
+ super("queue");
+ }
+
+ public queue_args getEmptyArgsInstance() {
+ return new queue_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public queue_result getResult(I iface, queue_args args) throws org.apache.thrift.TException {
+ queue_result result = new queue_result();
+ result.success = iface.queue(args._secret, args._queueName, args._message);
+ return result;
+ }
+ }
+
+ public static class requeue extends org.apache.thrift.ProcessFunction {
+ public requeue() {
+ super("requeue");
+ }
+
+ public requeue_args getEmptyArgsInstance() {
+ return new requeue_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public requeue_result getResult(I iface, requeue_args args) throws org.apache.thrift.TException {
+ requeue_result result = new requeue_result();
+ result.success = iface.requeue(args._secret, args._queueName, args._message);
+ return result;
+ }
+ }
+
+ public static class requeueSilent extends org.apache.thrift.ProcessFunction {
+ public requeueSilent() {
+ super("requeueSilent");
+ }
+
+ public requeueSilent_args getEmptyArgsInstance() {
+ return new requeueSilent_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public requeueSilent_result getResult(I iface, requeueSilent_args args) throws org.apache.thrift.TException {
+ requeueSilent_result result = new requeueSilent_result();
+ result.success = iface.requeueSilent(args._secret, args._queueName, args._message);
+ return result;
+ }
+ }
+
+ public static class finish extends org.apache.thrift.ProcessFunction {
+ public finish() {
+ super("finish");
+ }
+
+ public finish_args getEmptyArgsInstance() {
+ return new finish_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public finish_result getResult(I iface, finish_args args) throws org.apache.thrift.TException {
+ finish_result result = new finish_result();
+ result.success = iface.finish(args._secret, args._queueName, args._message);
+ return result;
+ }
+ }
+
+ public static class take extends org.apache.thrift.ProcessFunction {
+ public take() {
+ super("take");
+ }
+
+ public take_args getEmptyArgsInstance() {
+ return new take_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public take_result getResult(I iface, take_args args) throws org.apache.thrift.TException {
+ take_result result = new take_result();
+ result.success = iface.take(args._secret, args._queueName);
+ return result;
+ }
+ }
+
+ public static class queueSize extends org.apache.thrift.ProcessFunction {
+ public queueSize() {
+ super("queueSize");
+ }
+
+ public queueSize_args getEmptyArgsInstance() {
+ return new queueSize_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public queueSize_result getResult(I iface, queueSize_args args) throws org.apache.thrift.TException {
+ queueSize_result result = new queueSize_result();
+ result.success = iface.queueSize(args._secret, args._queueName);
+ return result;
+ }
+ }
+
+ public static class ephemeralSize extends org.apache.thrift.ProcessFunction {
+ public ephemeralSize() {
+ super("ephemeralSize");
+ }
+
+ public ephemeralSize_args getEmptyArgsInstance() {
+ return new ephemeralSize_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ public ephemeralSize_result getResult(I iface, ephemeralSize_args args) throws org.apache.thrift.TException {
+ ephemeralSize_result result = new ephemeralSize_result();
+ result.success = iface.ephemeralSize(args._secret, args._queueName);
+ 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>()));
+ }
+
+ protected AsyncProcessor(I iface, Map> processMap) {
+ super(iface, getProcessMap(processMap));
+ }
+
+ private static Map> getProcessMap(Map> processMap) {
+ processMap.put("ping", new ping());
+ processMap.put("ping2", new ping2());
+ processMap.put("queueExists", new queueExists());
+ processMap.put("initQueue", new initQueue());
+ processMap.put("queue", new queue());
+ processMap.put("requeue", new requeue());
+ processMap.put("requeueSilent", new requeueSilent());
+ processMap.put("finish", new finish());
+ processMap.put("take", new take());
+ processMap.put("queueSize", new queueSize());
+ processMap.put("ephemeralSize", new ephemeralSize());
+ return processMap;
+ }
+
+ public static class ping extends org.apache.thrift.AsyncProcessFunction {
+ public ping() {
+ super("ping");
+ }
+
+ public ping_args getEmptyArgsInstance() {
+ return new ping_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, ping_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException {
+ iface.ping(resultHandler);
+ }
+ }
+
+ public static class ping2 extends org.apache.thrift.AsyncProcessFunction {
+ public ping2() {
+ super("ping2");
+ }
+
+ public ping2_args getEmptyArgsInstance() {
+ return new ping2_args();
+ }
+
+ public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback() {
+ public void onComplete(Boolean o) {
+ ping2_result result = new ping2_result();
+ result.success = o;
+ result.setSuccessIsSet(true);
+ 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;
+ ping2_result result = new ping2_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, ping2_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException {
+ iface.ping2(resultHandler);
+ }
+ }
+
+ public static class queueExists extends org.apache.thrift.AsyncProcessFunction {
+ public queueExists() {
+ super("queueExists");
+ }
+
+ public queueExists_args getEmptyArgsInstance() {
+ return new queueExists_args();
+ }
+
+ public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback() {
+ public void onComplete(TQueueResponse o) {
+ queueExists_result result = new queueExists_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;
+ queueExists_result result = new queueExists_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, queueExists_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException {
+ iface.queueExists(args._secret, args._queueName,resultHandler);
+ }
+ }
+
+ public static class initQueue extends org.apache.thrift.AsyncProcessFunction {
+ public initQueue() {
+ super("initQueue");
+ }
+
+ public initQueue_args getEmptyArgsInstance() {
+ return new initQueue_args();
+ }
+
+ public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback() {
+ public void onComplete(TQueueResponse o) {
+ initQueue_result result = new initQueue_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;
+ initQueue_result result = new initQueue_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, initQueue_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException {
+ iface.initQueue(args._secret, args._queueName,resultHandler);
+ }
+ }
+
+ public static class queue extends org.apache.thrift.AsyncProcessFunction {
+ public queue() {
+ super("queue");
+ }
+
+ public queue_args getEmptyArgsInstance() {
+ return new queue_args();
+ }
+
+ public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback() {
+ public void onComplete(TQueueResponse o) {
+ queue_result result = new queue_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;
+ queue_result result = new queue_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, queue_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException {
+ iface.queue(args._secret, args._queueName, args._message,resultHandler);
+ }
+ }
+
+ public static class requeue extends org.apache.thrift.AsyncProcessFunction {
+ public requeue() {
+ super("requeue");
+ }
+
+ public requeue_args getEmptyArgsInstance() {
+ return new requeue_args();
+ }
+
+ public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback() {
+ public void onComplete(TQueueResponse o) {
+ requeue_result result = new requeue_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;
+ requeue_result result = new requeue_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, requeue_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException {
+ iface.requeue(args._secret, args._queueName, args._message,resultHandler);
+ }
+ }
+
+ public static class requeueSilent extends org.apache.thrift.AsyncProcessFunction {
+ public requeueSilent() {
+ super("requeueSilent");
+ }
+
+ public requeueSilent_args getEmptyArgsInstance() {
+ return new requeueSilent_args();
+ }
+
+ public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback() {
+ public void onComplete(TQueueResponse o) {
+ requeueSilent_result result = new requeueSilent_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;
+ requeueSilent_result result = new requeueSilent_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, requeueSilent_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException {
+ iface.requeueSilent(args._secret, args._queueName, args._message,resultHandler);
+ }
+ }
+
+ public static class finish extends org.apache.thrift.AsyncProcessFunction {
+ public finish() {
+ super("finish");
+ }
+
+ public finish_args getEmptyArgsInstance() {
+ return new finish_args();
+ }
+
+ public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback() {
+ public void onComplete(TQueueResponse o) {
+ finish_result result = new finish_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;
+ finish_result result = new finish_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, finish_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException {
+ iface.finish(args._secret, args._queueName, args._message,resultHandler);
+ }
+ }
+
+ public static class take extends org.apache.thrift.AsyncProcessFunction {
+ public take() {
+ super("take");
+ }
+
+ public take_args getEmptyArgsInstance() {
+ return new take_args();
+ }
+
+ public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback() {
+ public void onComplete(TQueueResponse o) {
+ take_result result = new take_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;
+ take_result result = new take_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, take_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException {
+ iface.take(args._secret, args._queueName,resultHandler);
+ }
+ }
+
+ public static class queueSize extends org.apache.thrift.AsyncProcessFunction {
+ public queueSize() {
+ super("queueSize");
+ }
+
+ public queueSize_args getEmptyArgsInstance() {
+ return new queueSize_args();
+ }
+
+ public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback() {
+ public void onComplete(TQueueSizeResponse o) {
+ queueSize_result result = new queueSize_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;
+ queueSize_result result = new queueSize_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, queueSize_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException {
+ iface.queueSize(args._secret, args._queueName,resultHandler);
+ }
+ }
+
+ public static class ephemeralSize extends org.apache.thrift.AsyncProcessFunction {
+ public ephemeralSize() {
+ super("ephemeralSize");
+ }
+
+ public ephemeralSize_args getEmptyArgsInstance() {
+ return new ephemeralSize_args();
+ }
+
+ public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+ final org.apache.thrift.AsyncProcessFunction fcall = this;
+ return new AsyncMethodCallback() {
+ public void onComplete(TQueueSizeResponse o) {
+ ephemeralSize_result result = new ephemeralSize_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;
+ ephemeralSize_result result = new ephemeralSize_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, ephemeralSize_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws TException {
+ iface.ephemeralSize(args._secret, args._queueName,resultHandler);
+ }
+ }
+
+ }
+
+ public static class ping_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("ping_args");
+
+
+ private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new ping_argsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new ping_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(ping_args.class, metaDataMap);
+ }
+
+ public ping_args() {
+ }
+
+ /**
+ * Performs a deep copy on other.
+ */
+ public ping_args(ping_args other) {
+ }
+
+ public ping_args deepCopy() {
+ return new ping_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 ping_args)
+ return this.equals((ping_args)that);
+ return false;
+ }
+
+ public boolean equals(ping_args that) {
+ if (that == null)
+ return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public int compareTo(ping_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("ping_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 ping_argsStandardSchemeFactory implements SchemeFactory {
+ public ping_argsStandardScheme getScheme() {
+ return new ping_argsStandardScheme();
+ }
+ }
+
+ private static class ping_argsStandardScheme extends StandardScheme {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, ping_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, ping_args struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class ping_argsTupleSchemeFactory implements SchemeFactory {
+ public ping_argsTupleScheme getScheme() {
+ return new ping_argsTupleScheme();
+ }
+ }
+
+ private static class ping_argsTupleScheme extends TupleScheme {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, ping_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, ping_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ }
+ }
+
+ }
+
+ public static class ping2_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("ping2_args");
+
+
+ private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new ping2_argsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new ping2_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(ping2_args.class, metaDataMap);
+ }
+
+ public ping2_args() {
+ }
+
+ /**
+ * Performs a deep copy on other.
+ */
+ public ping2_args(ping2_args other) {
+ }
+
+ public ping2_args deepCopy() {
+ return new ping2_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 ping2_args)
+ return this.equals((ping2_args)that);
+ return false;
+ }
+
+ public boolean equals(ping2_args that) {
+ if (that == null)
+ return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public int compareTo(ping2_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("ping2_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 ping2_argsStandardSchemeFactory implements SchemeFactory {
+ public ping2_argsStandardScheme getScheme() {
+ return new ping2_argsStandardScheme();
+ }
+ }
+
+ private static class ping2_argsStandardScheme extends StandardScheme {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, ping2_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, ping2_args struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class ping2_argsTupleSchemeFactory implements SchemeFactory {
+ public ping2_argsTupleScheme getScheme() {
+ return new ping2_argsTupleScheme();
+ }
+ }
+
+ private static class ping2_argsTupleScheme extends TupleScheme {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, ping2_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, ping2_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ }
+ }
+
+ }
+
+ public static class ping2_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("ping2_result");
+
+ private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.BOOL, (short)0);
+
+ private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new ping2_resultStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new ping2_resultTupleSchemeFactory());
+ }
+
+ public boolean 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
+ private static final int __SUCCESS_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.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.BOOL)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ping2_result.class, metaDataMap);
+ }
+
+ public ping2_result() {
+ }
+
+ public ping2_result(
+ boolean success)
+ {
+ this();
+ this.success = success;
+ setSuccessIsSet(true);
+ }
+
+ /**
+ * Performs a deep copy on other.
+ */
+ public ping2_result(ping2_result other) {
+ __isset_bitfield = other.__isset_bitfield;
+ this.success = other.success;
+ }
+
+ public ping2_result deepCopy() {
+ return new ping2_result(this);
+ }
+
+ @Override
+ public void clear() {
+ setSuccessIsSet(false);
+ this.success = false;
+ }
+
+ public boolean isSuccess() {
+ return this.success;
+ }
+
+ public ping2_result setSuccess(boolean success) {
+ this.success = success;
+ setSuccessIsSet(true);
+ return this;
+ }
+
+ public void unsetSuccess() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID);
+ }
+
+ /** Returns true if field success is set (has been assigned a value) and false otherwise */
+ public boolean isSetSuccess() {
+ return EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID);
+ }
+
+ public void setSuccessIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value);
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case SUCCESS:
+ if (value == null) {
+ unsetSuccess();
+ } else {
+ setSuccess((Boolean)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case SUCCESS:
+ return Boolean.valueOf(isSuccess());
+
+ }
+ 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 ping2_result)
+ return this.equals((ping2_result)that);
+ return false;
+ }
+
+ public boolean equals(ping2_result that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_success = true;
+ boolean that_present_success = true;
+ if (this_present_success || that_present_success) {
+ if (!(this_present_success && that_present_success))
+ return false;
+ if (this.success != that.success)
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public int compareTo(ping2_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("ping2_result(");
+ boolean first = true;
+
+ sb.append("success:");
+ 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 {
+ // 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 ping2_resultStandardSchemeFactory implements SchemeFactory {
+ public ping2_resultStandardScheme getScheme() {
+ return new ping2_resultStandardScheme();
+ }
+ }
+
+ private static class ping2_resultStandardScheme extends StandardScheme {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, ping2_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.BOOL) {
+ struct.success = iprot.readBool();
+ 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, ping2_result struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.isSetSuccess()) {
+ oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+ oprot.writeBool(struct.success);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class ping2_resultTupleSchemeFactory implements SchemeFactory {
+ public ping2_resultTupleScheme getScheme() {
+ return new ping2_resultTupleScheme();
+ }
+ }
+
+ private static class ping2_resultTupleScheme extends TupleScheme {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, ping2_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.writeBool(struct.success);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, ping2_result struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.success = iprot.readBool();
+ struct.setSuccessIsSet(true);
+ }
+ }
+ }
+
+ }
+
+ public static class queueExists_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("queueExists_args");
+
+ private static final org.apache.thrift.protocol.TField _SECRET_FIELD_DESC = new org.apache.thrift.protocol.TField("_secret", org.apache.thrift.protocol.TType.STRING, (short)1);
+ private static final org.apache.thrift.protocol.TField _QUEUE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("_queueName", org.apache.thrift.protocol.TType.STRING, (short)2);
+
+ private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new queueExists_argsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new queueExists_argsTupleSchemeFactory());
+ }
+
+ public String _secret; // required
+ public String _queueName; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ _SECRET((short)1, "_secret"),
+ _QUEUE_NAME((short)2, "_queueName");
+
+ 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: // _SECRET
+ return _SECRET;
+ case 2: // _QUEUE_NAME
+ return _QUEUE_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._SECRET, new org.apache.thrift.meta_data.FieldMetaData("_secret", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields._QUEUE_NAME, new org.apache.thrift.meta_data.FieldMetaData("_queueName", 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(queueExists_args.class, metaDataMap);
+ }
+
+ public queueExists_args() {
+ }
+
+ public queueExists_args(
+ String _secret,
+ String _queueName)
+ {
+ this();
+ this._secret = _secret;
+ this._queueName = _queueName;
+ }
+
+ /**
+ * Performs a deep copy on other.
+ */
+ public queueExists_args(queueExists_args other) {
+ if (other.isSet_secret()) {
+ this._secret = other._secret;
+ }
+ if (other.isSet_queueName()) {
+ this._queueName = other._queueName;
+ }
+ }
+
+ public queueExists_args deepCopy() {
+ return new queueExists_args(this);
+ }
+
+ @Override
+ public void clear() {
+ this._secret = null;
+ this._queueName = null;
+ }
+
+ public String get_secret() {
+ return this._secret;
+ }
+
+ public queueExists_args set_secret(String _secret) {
+ this._secret = _secret;
+ return this;
+ }
+
+ public void unset_secret() {
+ this._secret = null;
+ }
+
+ /** Returns true if field _secret is set (has been assigned a value) and false otherwise */
+ public boolean isSet_secret() {
+ return this._secret != null;
+ }
+
+ public void set_secretIsSet(boolean value) {
+ if (!value) {
+ this._secret = null;
+ }
+ }
+
+ public String get_queueName() {
+ return this._queueName;
+ }
+
+ public queueExists_args set_queueName(String _queueName) {
+ this._queueName = _queueName;
+ return this;
+ }
+
+ public void unset_queueName() {
+ this._queueName = null;
+ }
+
+ /** Returns true if field _queueName is set (has been assigned a value) and false otherwise */
+ public boolean isSet_queueName() {
+ return this._queueName != null;
+ }
+
+ public void set_queueNameIsSet(boolean value) {
+ if (!value) {
+ this._queueName = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case _SECRET:
+ if (value == null) {
+ unset_secret();
+ } else {
+ set_secret((String)value);
+ }
+ break;
+
+ case _QUEUE_NAME:
+ if (value == null) {
+ unset_queueName();
+ } else {
+ set_queueName((String)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case _SECRET:
+ return get_secret();
+
+ case _QUEUE_NAME:
+ return get_queueName();
+
+ }
+ 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 _SECRET:
+ return isSet_secret();
+ case _QUEUE_NAME:
+ return isSet_queueName();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof queueExists_args)
+ return this.equals((queueExists_args)that);
+ return false;
+ }
+
+ public boolean equals(queueExists_args that) {
+ if (that == null)
+ return false;
+
+ boolean this_present__secret = true && this.isSet_secret();
+ boolean that_present__secret = true && that.isSet_secret();
+ if (this_present__secret || that_present__secret) {
+ if (!(this_present__secret && that_present__secret))
+ return false;
+ if (!this._secret.equals(that._secret))
+ return false;
+ }
+
+ boolean this_present__queueName = true && this.isSet_queueName();
+ boolean that_present__queueName = true && that.isSet_queueName();
+ if (this_present__queueName || that_present__queueName) {
+ if (!(this_present__queueName && that_present__queueName))
+ return false;
+ if (!this._queueName.equals(that._queueName))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public int compareTo(queueExists_args other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(isSet_secret()).compareTo(other.isSet_secret());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSet_secret()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this._secret, other._secret);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSet_queueName()).compareTo(other.isSet_queueName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSet_queueName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this._queueName, other._queueName);
+ 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("queueExists_args(");
+ boolean first = true;
+
+ sb.append("_secret:");
+ if (this._secret == null) {
+ sb.append("null");
+ } else {
+ sb.append(this._secret);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("_queueName:");
+ if (this._queueName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this._queueName);
+ }
+ 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 queueExists_argsStandardSchemeFactory implements SchemeFactory {
+ public queueExists_argsStandardScheme getScheme() {
+ return new queueExists_argsStandardScheme();
+ }
+ }
+
+ private static class queueExists_argsStandardScheme extends StandardScheme {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, queueExists_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: // _SECRET
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct._secret = iprot.readString();
+ struct.set_secretIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // _QUEUE_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct._queueName = iprot.readString();
+ struct.set_queueNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, queueExists_args struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct._secret != null) {
+ oprot.writeFieldBegin(_SECRET_FIELD_DESC);
+ oprot.writeString(struct._secret);
+ oprot.writeFieldEnd();
+ }
+ if (struct._queueName != null) {
+ oprot.writeFieldBegin(_QUEUE_NAME_FIELD_DESC);
+ oprot.writeString(struct._queueName);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class queueExists_argsTupleSchemeFactory implements SchemeFactory {
+ public queueExists_argsTupleScheme getScheme() {
+ return new queueExists_argsTupleScheme();
+ }
+ }
+
+ private static class queueExists_argsTupleScheme extends TupleScheme {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, queueExists_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSet_secret()) {
+ optionals.set(0);
+ }
+ if (struct.isSet_queueName()) {
+ optionals.set(1);
+ }
+ oprot.writeBitSet(optionals, 2);
+ if (struct.isSet_secret()) {
+ oprot.writeString(struct._secret);
+ }
+ if (struct.isSet_queueName()) {
+ oprot.writeString(struct._queueName);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, queueExists_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(2);
+ if (incoming.get(0)) {
+ struct._secret = iprot.readString();
+ struct.set_secretIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct._queueName = iprot.readString();
+ struct.set_queueNameIsSet(true);
+ }
+ }
+ }
+
+ }
+
+ public static class queueExists_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("queueExists_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 queueExists_resultStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new queueExists_resultTupleSchemeFactory());
+ }
+
+ public TQueueResponse 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, TQueueResponse.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(queueExists_result.class, metaDataMap);
+ }
+
+ public queueExists_result() {
+ }
+
+ public queueExists_result(
+ TQueueResponse success)
+ {
+ this();
+ this.success = success;
+ }
+
+ /**
+ * Performs a deep copy on other.
+ */
+ public queueExists_result(queueExists_result other) {
+ if (other.isSetSuccess()) {
+ this.success = new TQueueResponse(other.success);
+ }
+ }
+
+ public queueExists_result deepCopy() {
+ return new queueExists_result(this);
+ }
+
+ @Override
+ public void clear() {
+ this.success = null;
+ }
+
+ public TQueueResponse getSuccess() {
+ return this.success;
+ }
+
+ public queueExists_result setSuccess(TQueueResponse 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((TQueueResponse)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 queueExists_result)
+ return this.equals((queueExists_result)that);
+ return false;
+ }
+
+ public boolean equals(queueExists_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(queueExists_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("queueExists_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 queueExists_resultStandardSchemeFactory implements SchemeFactory {
+ public queueExists_resultStandardScheme getScheme() {
+ return new queueExists_resultStandardScheme();
+ }
+ }
+
+ private static class queueExists_resultStandardScheme extends StandardScheme {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, queueExists_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 TQueueResponse();
+ 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, queueExists_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 queueExists_resultTupleSchemeFactory implements SchemeFactory {
+ public queueExists_resultTupleScheme getScheme() {
+ return new queueExists_resultTupleScheme();
+ }
+ }
+
+ private static class queueExists_resultTupleScheme extends TupleScheme {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, queueExists_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, queueExists_result struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.success = new TQueueResponse();
+ struct.success.read(iprot);
+ struct.setSuccessIsSet(true);
+ }
+ }
+ }
+
+ }
+
+ public static class initQueue_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("initQueue_args");
+
+ private static final org.apache.thrift.protocol.TField _SECRET_FIELD_DESC = new org.apache.thrift.protocol.TField("_secret", org.apache.thrift.protocol.TType.STRING, (short)1);
+ private static final org.apache.thrift.protocol.TField _QUEUE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("_queueName", org.apache.thrift.protocol.TType.STRING, (short)2);
+
+ private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new initQueue_argsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new initQueue_argsTupleSchemeFactory());
+ }
+
+ public String _secret; // required
+ public String _queueName; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ _SECRET((short)1, "_secret"),
+ _QUEUE_NAME((short)2, "_queueName");
+
+ 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: // _SECRET
+ return _SECRET;
+ case 2: // _QUEUE_NAME
+ return _QUEUE_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._SECRET, new org.apache.thrift.meta_data.FieldMetaData("_secret", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields._QUEUE_NAME, new org.apache.thrift.meta_data.FieldMetaData("_queueName", 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(initQueue_args.class, metaDataMap);
+ }
+
+ public initQueue_args() {
+ }
+
+ public initQueue_args(
+ String _secret,
+ String _queueName)
+ {
+ this();
+ this._secret = _secret;
+ this._queueName = _queueName;
+ }
+
+ /**
+ * Performs a deep copy on other.
+ */
+ public initQueue_args(initQueue_args other) {
+ if (other.isSet_secret()) {
+ this._secret = other._secret;
+ }
+ if (other.isSet_queueName()) {
+ this._queueName = other._queueName;
+ }
+ }
+
+ public initQueue_args deepCopy() {
+ return new initQueue_args(this);
+ }
+
+ @Override
+ public void clear() {
+ this._secret = null;
+ this._queueName = null;
+ }
+
+ public String get_secret() {
+ return this._secret;
+ }
+
+ public initQueue_args set_secret(String _secret) {
+ this._secret = _secret;
+ return this;
+ }
+
+ public void unset_secret() {
+ this._secret = null;
+ }
+
+ /** Returns true if field _secret is set (has been assigned a value) and false otherwise */
+ public boolean isSet_secret() {
+ return this._secret != null;
+ }
+
+ public void set_secretIsSet(boolean value) {
+ if (!value) {
+ this._secret = null;
+ }
+ }
+
+ public String get_queueName() {
+ return this._queueName;
+ }
+
+ public initQueue_args set_queueName(String _queueName) {
+ this._queueName = _queueName;
+ return this;
+ }
+
+ public void unset_queueName() {
+ this._queueName = null;
+ }
+
+ /** Returns true if field _queueName is set (has been assigned a value) and false otherwise */
+ public boolean isSet_queueName() {
+ return this._queueName != null;
+ }
+
+ public void set_queueNameIsSet(boolean value) {
+ if (!value) {
+ this._queueName = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case _SECRET:
+ if (value == null) {
+ unset_secret();
+ } else {
+ set_secret((String)value);
+ }
+ break;
+
+ case _QUEUE_NAME:
+ if (value == null) {
+ unset_queueName();
+ } else {
+ set_queueName((String)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case _SECRET:
+ return get_secret();
+
+ case _QUEUE_NAME:
+ return get_queueName();
+
+ }
+ 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 _SECRET:
+ return isSet_secret();
+ case _QUEUE_NAME:
+ return isSet_queueName();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof initQueue_args)
+ return this.equals((initQueue_args)that);
+ return false;
+ }
+
+ public boolean equals(initQueue_args that) {
+ if (that == null)
+ return false;
+
+ boolean this_present__secret = true && this.isSet_secret();
+ boolean that_present__secret = true && that.isSet_secret();
+ if (this_present__secret || that_present__secret) {
+ if (!(this_present__secret && that_present__secret))
+ return false;
+ if (!this._secret.equals(that._secret))
+ return false;
+ }
+
+ boolean this_present__queueName = true && this.isSet_queueName();
+ boolean that_present__queueName = true && that.isSet_queueName();
+ if (this_present__queueName || that_present__queueName) {
+ if (!(this_present__queueName && that_present__queueName))
+ return false;
+ if (!this._queueName.equals(that._queueName))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public int compareTo(initQueue_args other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(isSet_secret()).compareTo(other.isSet_secret());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSet_secret()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this._secret, other._secret);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSet_queueName()).compareTo(other.isSet_queueName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSet_queueName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this._queueName, other._queueName);
+ 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("initQueue_args(");
+ boolean first = true;
+
+ sb.append("_secret:");
+ if (this._secret == null) {
+ sb.append("null");
+ } else {
+ sb.append(this._secret);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("_queueName:");
+ if (this._queueName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this._queueName);
+ }
+ 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 initQueue_argsStandardSchemeFactory implements SchemeFactory {
+ public initQueue_argsStandardScheme getScheme() {
+ return new initQueue_argsStandardScheme();
+ }
+ }
+
+ private static class initQueue_argsStandardScheme extends StandardScheme {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, initQueue_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: // _SECRET
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct._secret = iprot.readString();
+ struct.set_secretIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // _QUEUE_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct._queueName = iprot.readString();
+ struct.set_queueNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, initQueue_args struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct._secret != null) {
+ oprot.writeFieldBegin(_SECRET_FIELD_DESC);
+ oprot.writeString(struct._secret);
+ oprot.writeFieldEnd();
+ }
+ if (struct._queueName != null) {
+ oprot.writeFieldBegin(_QUEUE_NAME_FIELD_DESC);
+ oprot.writeString(struct._queueName);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class initQueue_argsTupleSchemeFactory implements SchemeFactory {
+ public initQueue_argsTupleScheme getScheme() {
+ return new initQueue_argsTupleScheme();
+ }
+ }
+
+ private static class initQueue_argsTupleScheme extends TupleScheme {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, initQueue_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSet_secret()) {
+ optionals.set(0);
+ }
+ if (struct.isSet_queueName()) {
+ optionals.set(1);
+ }
+ oprot.writeBitSet(optionals, 2);
+ if (struct.isSet_secret()) {
+ oprot.writeString(struct._secret);
+ }
+ if (struct.isSet_queueName()) {
+ oprot.writeString(struct._queueName);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, initQueue_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(2);
+ if (incoming.get(0)) {
+ struct._secret = iprot.readString();
+ struct.set_secretIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct._queueName = iprot.readString();
+ struct.set_queueNameIsSet(true);
+ }
+ }
+ }
+
+ }
+
+ public static class initQueue_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("initQueue_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 initQueue_resultStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new initQueue_resultTupleSchemeFactory());
+ }
+
+ public TQueueResponse 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, TQueueResponse.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(initQueue_result.class, metaDataMap);
+ }
+
+ public initQueue_result() {
+ }
+
+ public initQueue_result(
+ TQueueResponse success)
+ {
+ this();
+ this.success = success;
+ }
+
+ /**
+ * Performs a deep copy on other.
+ */
+ public initQueue_result(initQueue_result other) {
+ if (other.isSetSuccess()) {
+ this.success = new TQueueResponse(other.success);
+ }
+ }
+
+ public initQueue_result deepCopy() {
+ return new initQueue_result(this);
+ }
+
+ @Override
+ public void clear() {
+ this.success = null;
+ }
+
+ public TQueueResponse getSuccess() {
+ return this.success;
+ }
+
+ public initQueue_result setSuccess(TQueueResponse 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((TQueueResponse)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 initQueue_result)
+ return this.equals((initQueue_result)that);
+ return false;
+ }
+
+ public boolean equals(initQueue_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(initQueue_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("initQueue_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 initQueue_resultStandardSchemeFactory implements SchemeFactory {
+ public initQueue_resultStandardScheme getScheme() {
+ return new initQueue_resultStandardScheme();
+ }
+ }
+
+ private static class initQueue_resultStandardScheme extends StandardScheme {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, initQueue_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 TQueueResponse();
+ 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, initQueue_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 initQueue_resultTupleSchemeFactory implements SchemeFactory {
+ public initQueue_resultTupleScheme getScheme() {
+ return new initQueue_resultTupleScheme();
+ }
+ }
+
+ private static class initQueue_resultTupleScheme extends TupleScheme {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, initQueue_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, initQueue_result struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.success = new TQueueResponse();
+ struct.success.read(iprot);
+ struct.setSuccessIsSet(true);
+ }
+ }
+ }
+
+ }
+
+ public static class queue_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("queue_args");
+
+ private static final org.apache.thrift.protocol.TField _SECRET_FIELD_DESC = new org.apache.thrift.protocol.TField("_secret", org.apache.thrift.protocol.TType.STRING, (short)1);
+ private static final org.apache.thrift.protocol.TField _QUEUE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("_queueName", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField _MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("_message", org.apache.thrift.protocol.TType.STRUCT, (short)3);
+
+ private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new queue_argsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new queue_argsTupleSchemeFactory());
+ }
+
+ public String _secret; // required
+ public String _queueName; // required
+ public TQueueMessage _message; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ _SECRET((short)1, "_secret"),
+ _QUEUE_NAME((short)2, "_queueName"),
+ _MESSAGE((short)3, "_message");
+
+ 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: // _SECRET
+ return _SECRET;
+ case 2: // _QUEUE_NAME
+ return _QUEUE_NAME;
+ case 3: // _MESSAGE
+ return _MESSAGE;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches 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._SECRET, new org.apache.thrift.meta_data.FieldMetaData("_secret", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields._QUEUE_NAME, new org.apache.thrift.meta_data.FieldMetaData("_queueName", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields._MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("_message", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TQueueMessage.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(queue_args.class, metaDataMap);
+ }
+
+ public queue_args() {
+ }
+
+ public queue_args(
+ String _secret,
+ String _queueName,
+ TQueueMessage _message)
+ {
+ this();
+ this._secret = _secret;
+ this._queueName = _queueName;
+ this._message = _message;
+ }
+
+ /**
+ * Performs a deep copy on other.
+ */
+ public queue_args(queue_args other) {
+ if (other.isSet_secret()) {
+ this._secret = other._secret;
+ }
+ if (other.isSet_queueName()) {
+ this._queueName = other._queueName;
+ }
+ if (other.isSet_message()) {
+ this._message = new TQueueMessage(other._message);
+ }
+ }
+
+ public queue_args deepCopy() {
+ return new queue_args(this);
+ }
+
+ @Override
+ public void clear() {
+ this._secret = null;
+ this._queueName = null;
+ this._message = null;
+ }
+
+ public String get_secret() {
+ return this._secret;
+ }
+
+ public queue_args set_secret(String _secret) {
+ this._secret = _secret;
+ return this;
+ }
+
+ public void unset_secret() {
+ this._secret = null;
+ }
+
+ /** Returns true if field _secret is set (has been assigned a value) and false otherwise */
+ public boolean isSet_secret() {
+ return this._secret != null;
+ }
+
+ public void set_secretIsSet(boolean value) {
+ if (!value) {
+ this._secret = null;
+ }
+ }
+
+ public String get_queueName() {
+ return this._queueName;
+ }
+
+ public queue_args set_queueName(String _queueName) {
+ this._queueName = _queueName;
+ return this;
+ }
+
+ public void unset_queueName() {
+ this._queueName = null;
+ }
+
+ /** Returns true if field _queueName is set (has been assigned a value) and false otherwise */
+ public boolean isSet_queueName() {
+ return this._queueName != null;
+ }
+
+ public void set_queueNameIsSet(boolean value) {
+ if (!value) {
+ this._queueName = null;
+ }
+ }
+
+ public TQueueMessage get_message() {
+ return this._message;
+ }
+
+ public queue_args set_message(TQueueMessage _message) {
+ this._message = _message;
+ return this;
+ }
+
+ public void unset_message() {
+ this._message = null;
+ }
+
+ /** Returns true if field _message is set (has been assigned a value) and false otherwise */
+ public boolean isSet_message() {
+ return this._message != null;
+ }
+
+ public void set_messageIsSet(boolean value) {
+ if (!value) {
+ this._message = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case _SECRET:
+ if (value == null) {
+ unset_secret();
+ } else {
+ set_secret((String)value);
+ }
+ break;
+
+ case _QUEUE_NAME:
+ if (value == null) {
+ unset_queueName();
+ } else {
+ set_queueName((String)value);
+ }
+ break;
+
+ case _MESSAGE:
+ if (value == null) {
+ unset_message();
+ } else {
+ set_message((TQueueMessage)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case _SECRET:
+ return get_secret();
+
+ case _QUEUE_NAME:
+ return get_queueName();
+
+ case _MESSAGE:
+ return get_message();
+
+ }
+ 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 _SECRET:
+ return isSet_secret();
+ case _QUEUE_NAME:
+ return isSet_queueName();
+ case _MESSAGE:
+ return isSet_message();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof queue_args)
+ return this.equals((queue_args)that);
+ return false;
+ }
+
+ public boolean equals(queue_args that) {
+ if (that == null)
+ return false;
+
+ boolean this_present__secret = true && this.isSet_secret();
+ boolean that_present__secret = true && that.isSet_secret();
+ if (this_present__secret || that_present__secret) {
+ if (!(this_present__secret && that_present__secret))
+ return false;
+ if (!this._secret.equals(that._secret))
+ return false;
+ }
+
+ boolean this_present__queueName = true && this.isSet_queueName();
+ boolean that_present__queueName = true && that.isSet_queueName();
+ if (this_present__queueName || that_present__queueName) {
+ if (!(this_present__queueName && that_present__queueName))
+ return false;
+ if (!this._queueName.equals(that._queueName))
+ return false;
+ }
+
+ boolean this_present__message = true && this.isSet_message();
+ boolean that_present__message = true && that.isSet_message();
+ if (this_present__message || that_present__message) {
+ if (!(this_present__message && that_present__message))
+ return false;
+ if (!this._message.equals(that._message))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public int compareTo(queue_args other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(isSet_secret()).compareTo(other.isSet_secret());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSet_secret()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this._secret, other._secret);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSet_queueName()).compareTo(other.isSet_queueName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSet_queueName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this._queueName, other._queueName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSet_message()).compareTo(other.isSet_message());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSet_message()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this._message, other._message);
+ 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("queue_args(");
+ boolean first = true;
+
+ sb.append("_secret:");
+ if (this._secret == null) {
+ sb.append("null");
+ } else {
+ sb.append(this._secret);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("_queueName:");
+ if (this._queueName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this._queueName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("_message:");
+ if (this._message == null) {
+ sb.append("null");
+ } else {
+ sb.append(this._message);
+ }
+ 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 (_message != null) {
+ _message.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 queue_argsStandardSchemeFactory implements SchemeFactory {
+ public queue_argsStandardScheme getScheme() {
+ return new queue_argsStandardScheme();
+ }
+ }
+
+ private static class queue_argsStandardScheme extends StandardScheme {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, queue_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: // _SECRET
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct._secret = iprot.readString();
+ struct.set_secretIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // _QUEUE_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct._queueName = iprot.readString();
+ struct.set_queueNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // _MESSAGE
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct._message = new TQueueMessage();
+ struct._message.read(iprot);
+ struct.set_messageIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, queue_args struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct._secret != null) {
+ oprot.writeFieldBegin(_SECRET_FIELD_DESC);
+ oprot.writeString(struct._secret);
+ oprot.writeFieldEnd();
+ }
+ if (struct._queueName != null) {
+ oprot.writeFieldBegin(_QUEUE_NAME_FIELD_DESC);
+ oprot.writeString(struct._queueName);
+ oprot.writeFieldEnd();
+ }
+ if (struct._message != null) {
+ oprot.writeFieldBegin(_MESSAGE_FIELD_DESC);
+ struct._message.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class queue_argsTupleSchemeFactory implements SchemeFactory {
+ public queue_argsTupleScheme getScheme() {
+ return new queue_argsTupleScheme();
+ }
+ }
+
+ private static class queue_argsTupleScheme extends TupleScheme {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, queue_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSet_secret()) {
+ optionals.set(0);
+ }
+ if (struct.isSet_queueName()) {
+ optionals.set(1);
+ }
+ if (struct.isSet_message()) {
+ optionals.set(2);
+ }
+ oprot.writeBitSet(optionals, 3);
+ if (struct.isSet_secret()) {
+ oprot.writeString(struct._secret);
+ }
+ if (struct.isSet_queueName()) {
+ oprot.writeString(struct._queueName);
+ }
+ if (struct.isSet_message()) {
+ struct._message.write(oprot);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, queue_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(3);
+ if (incoming.get(0)) {
+ struct._secret = iprot.readString();
+ struct.set_secretIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct._queueName = iprot.readString();
+ struct.set_queueNameIsSet(true);
+ }
+ if (incoming.get(2)) {
+ struct._message = new TQueueMessage();
+ struct._message.read(iprot);
+ struct.set_messageIsSet(true);
+ }
+ }
+ }
+
+ }
+
+ public static class queue_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("queue_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 queue_resultStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new queue_resultTupleSchemeFactory());
+ }
+
+ public TQueueResponse 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, TQueueResponse.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(queue_result.class, metaDataMap);
+ }
+
+ public queue_result() {
+ }
+
+ public queue_result(
+ TQueueResponse success)
+ {
+ this();
+ this.success = success;
+ }
+
+ /**
+ * Performs a deep copy on other.
+ */
+ public queue_result(queue_result other) {
+ if (other.isSetSuccess()) {
+ this.success = new TQueueResponse(other.success);
+ }
+ }
+
+ public queue_result deepCopy() {
+ return new queue_result(this);
+ }
+
+ @Override
+ public void clear() {
+ this.success = null;
+ }
+
+ public TQueueResponse getSuccess() {
+ return this.success;
+ }
+
+ public queue_result setSuccess(TQueueResponse 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((TQueueResponse)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 queue_result)
+ return this.equals((queue_result)that);
+ return false;
+ }
+
+ public boolean equals(queue_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(queue_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("queue_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 queue_resultStandardSchemeFactory implements SchemeFactory {
+ public queue_resultStandardScheme getScheme() {
+ return new queue_resultStandardScheme();
+ }
+ }
+
+ private static class queue_resultStandardScheme extends StandardScheme {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, queue_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 TQueueResponse();
+ 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, queue_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 queue_resultTupleSchemeFactory implements SchemeFactory {
+ public queue_resultTupleScheme getScheme() {
+ return new queue_resultTupleScheme();
+ }
+ }
+
+ private static class queue_resultTupleScheme extends TupleScheme {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, queue_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, queue_result struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.success = new TQueueResponse();
+ struct.success.read(iprot);
+ struct.setSuccessIsSet(true);
+ }
+ }
+ }
+
+ }
+
+ public static class requeue_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("requeue_args");
+
+ private static final org.apache.thrift.protocol.TField _SECRET_FIELD_DESC = new org.apache.thrift.protocol.TField("_secret", org.apache.thrift.protocol.TType.STRING, (short)1);
+ private static final org.apache.thrift.protocol.TField _QUEUE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("_queueName", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField _MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("_message", org.apache.thrift.protocol.TType.STRUCT, (short)3);
+
+ private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new requeue_argsStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new requeue_argsTupleSchemeFactory());
+ }
+
+ public String _secret; // required
+ public String _queueName; // required
+ public TQueueMessage _message; // required
+
+ /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+ public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+ _SECRET((short)1, "_secret"),
+ _QUEUE_NAME((short)2, "_queueName"),
+ _MESSAGE((short)3, "_message");
+
+ 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: // _SECRET
+ return _SECRET;
+ case 2: // _QUEUE_NAME
+ return _QUEUE_NAME;
+ case 3: // _MESSAGE
+ return _MESSAGE;
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Find the _Fields constant that matches 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._SECRET, new org.apache.thrift.meta_data.FieldMetaData("_secret", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields._QUEUE_NAME, new org.apache.thrift.meta_data.FieldMetaData("_queueName", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields._MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("_message", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TQueueMessage.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(requeue_args.class, metaDataMap);
+ }
+
+ public requeue_args() {
+ }
+
+ public requeue_args(
+ String _secret,
+ String _queueName,
+ TQueueMessage _message)
+ {
+ this();
+ this._secret = _secret;
+ this._queueName = _queueName;
+ this._message = _message;
+ }
+
+ /**
+ * Performs a deep copy on other.
+ */
+ public requeue_args(requeue_args other) {
+ if (other.isSet_secret()) {
+ this._secret = other._secret;
+ }
+ if (other.isSet_queueName()) {
+ this._queueName = other._queueName;
+ }
+ if (other.isSet_message()) {
+ this._message = new TQueueMessage(other._message);
+ }
+ }
+
+ public requeue_args deepCopy() {
+ return new requeue_args(this);
+ }
+
+ @Override
+ public void clear() {
+ this._secret = null;
+ this._queueName = null;
+ this._message = null;
+ }
+
+ public String get_secret() {
+ return this._secret;
+ }
+
+ public requeue_args set_secret(String _secret) {
+ this._secret = _secret;
+ return this;
+ }
+
+ public void unset_secret() {
+ this._secret = null;
+ }
+
+ /** Returns true if field _secret is set (has been assigned a value) and false otherwise */
+ public boolean isSet_secret() {
+ return this._secret != null;
+ }
+
+ public void set_secretIsSet(boolean value) {
+ if (!value) {
+ this._secret = null;
+ }
+ }
+
+ public String get_queueName() {
+ return this._queueName;
+ }
+
+ public requeue_args set_queueName(String _queueName) {
+ this._queueName = _queueName;
+ return this;
+ }
+
+ public void unset_queueName() {
+ this._queueName = null;
+ }
+
+ /** Returns true if field _queueName is set (has been assigned a value) and false otherwise */
+ public boolean isSet_queueName() {
+ return this._queueName != null;
+ }
+
+ public void set_queueNameIsSet(boolean value) {
+ if (!value) {
+ this._queueName = null;
+ }
+ }
+
+ public TQueueMessage get_message() {
+ return this._message;
+ }
+
+ public requeue_args set_message(TQueueMessage _message) {
+ this._message = _message;
+ return this;
+ }
+
+ public void unset_message() {
+ this._message = null;
+ }
+
+ /** Returns true if field _message is set (has been assigned a value) and false otherwise */
+ public boolean isSet_message() {
+ return this._message != null;
+ }
+
+ public void set_messageIsSet(boolean value) {
+ if (!value) {
+ this._message = null;
+ }
+ }
+
+ public void setFieldValue(_Fields field, Object value) {
+ switch (field) {
+ case _SECRET:
+ if (value == null) {
+ unset_secret();
+ } else {
+ set_secret((String)value);
+ }
+ break;
+
+ case _QUEUE_NAME:
+ if (value == null) {
+ unset_queueName();
+ } else {
+ set_queueName((String)value);
+ }
+ break;
+
+ case _MESSAGE:
+ if (value == null) {
+ unset_message();
+ } else {
+ set_message((TQueueMessage)value);
+ }
+ break;
+
+ }
+ }
+
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case _SECRET:
+ return get_secret();
+
+ case _QUEUE_NAME:
+ return get_queueName();
+
+ case _MESSAGE:
+ return get_message();
+
+ }
+ 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 _SECRET:
+ return isSet_secret();
+ case _QUEUE_NAME:
+ return isSet_queueName();
+ case _MESSAGE:
+ return isSet_message();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof requeue_args)
+ return this.equals((requeue_args)that);
+ return false;
+ }
+
+ public boolean equals(requeue_args that) {
+ if (that == null)
+ return false;
+
+ boolean this_present__secret = true && this.isSet_secret();
+ boolean that_present__secret = true && that.isSet_secret();
+ if (this_present__secret || that_present__secret) {
+ if (!(this_present__secret && that_present__secret))
+ return false;
+ if (!this._secret.equals(that._secret))
+ return false;
+ }
+
+ boolean this_present__queueName = true && this.isSet_queueName();
+ boolean that_present__queueName = true && that.isSet_queueName();
+ if (this_present__queueName || that_present__queueName) {
+ if (!(this_present__queueName && that_present__queueName))
+ return false;
+ if (!this._queueName.equals(that._queueName))
+ return false;
+ }
+
+ boolean this_present__message = true && this.isSet_message();
+ boolean that_present__message = true && that.isSet_message();
+ if (this_present__message || that_present__message) {
+ if (!(this_present__message && that_present__message))
+ return false;
+ if (!this._message.equals(that._message))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public int compareTo(requeue_args other) {
+ if (!getClass().equals(other.getClass())) {
+ return getClass().getName().compareTo(other.getClass().getName());
+ }
+
+ int lastComparison = 0;
+
+ lastComparison = Boolean.valueOf(isSet_secret()).compareTo(other.isSet_secret());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSet_secret()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this._secret, other._secret);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSet_queueName()).compareTo(other.isSet_queueName());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSet_queueName()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this._queueName, other._queueName);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSet_message()).compareTo(other.isSet_message());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSet_message()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this._message, other._message);
+ 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("requeue_args(");
+ boolean first = true;
+
+ sb.append("_secret:");
+ if (this._secret == null) {
+ sb.append("null");
+ } else {
+ sb.append(this._secret);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("_queueName:");
+ if (this._queueName == null) {
+ sb.append("null");
+ } else {
+ sb.append(this._queueName);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("_message:");
+ if (this._message == null) {
+ sb.append("null");
+ } else {
+ sb.append(this._message);
+ }
+ 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 (_message != null) {
+ _message.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 requeue_argsStandardSchemeFactory implements SchemeFactory {
+ public requeue_argsStandardScheme getScheme() {
+ return new requeue_argsStandardScheme();
+ }
+ }
+
+ private static class requeue_argsStandardScheme extends StandardScheme {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, requeue_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: // _SECRET
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct._secret = iprot.readString();
+ struct.set_secretIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // _QUEUE_NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct._queueName = iprot.readString();
+ struct.set_queueNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // _MESSAGE
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct._message = new TQueueMessage();
+ struct._message.read(iprot);
+ struct.set_messageIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ default:
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+
+ // check for required fields of primitive type, which can't be checked in the validate method
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, requeue_args struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct._secret != null) {
+ oprot.writeFieldBegin(_SECRET_FIELD_DESC);
+ oprot.writeString(struct._secret);
+ oprot.writeFieldEnd();
+ }
+ if (struct._queueName != null) {
+ oprot.writeFieldBegin(_QUEUE_NAME_FIELD_DESC);
+ oprot.writeString(struct._queueName);
+ oprot.writeFieldEnd();
+ }
+ if (struct._message != null) {
+ oprot.writeFieldBegin(_MESSAGE_FIELD_DESC);
+ struct._message.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class requeue_argsTupleSchemeFactory implements SchemeFactory {
+ public requeue_argsTupleScheme getScheme() {
+ return new requeue_argsTupleScheme();
+ }
+ }
+
+ private static class requeue_argsTupleScheme extends TupleScheme {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, requeue_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ BitSet optionals = new BitSet();
+ if (struct.isSet_secret()) {
+ optionals.set(0);
+ }
+ if (struct.isSet_queueName()) {
+ optionals.set(1);
+ }
+ if (struct.isSet_message()) {
+ optionals.set(2);
+ }
+ oprot.writeBitSet(optionals, 3);
+ if (struct.isSet_secret()) {
+ oprot.writeString(struct._secret);
+ }
+ if (struct.isSet_queueName()) {
+ oprot.writeString(struct._queueName);
+ }
+ if (struct.isSet_message()) {
+ struct._message.write(oprot);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, requeue_args struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(3);
+ if (incoming.get(0)) {
+ struct._secret = iprot.readString();
+ struct.set_secretIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct._queueName = iprot.readString();
+ struct.set_queueNameIsSet(true);
+ }
+ if (incoming.get(2)) {
+ struct._message = new TQueueMessage();
+ struct._message.read(iprot);
+ struct.set_messageIsSet(true);
+ }
+ }
+ }
+
+ }
+
+ public static class requeue_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("requeue_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 requeue_resultStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new requeue_resultTupleSchemeFactory());
+ }
+
+ public TQueueResponse 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, TQueueResponse.class)));
+ metaDataMap = Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(requeue_result.class, metaDataMap);
+ }
+
+ public requeue_result() {
+ }
+
+ public requeue_result(
+ TQueueResponse success)
+ {
+ this();
+ this.success = success;
+ }
+
+ /**
+ * Performs a deep copy on other.
+ */
+ public requeue_result(requeue_result other) {
+ if (other.isSetSuccess()) {
+ this.success = new TQueueResponse(other.success);
+ }
+ }
+
+ public requeue_result deepCopy() {
+ return new requeue_result(this);
+ }
+
+ @Override
+ public void clear() {
+ this.success = null;
+ }
+
+ public TQueueResponse getSuccess() {
+ return this.success;
+ }
+
+ public requeue_result setSuccess(TQueueResponse 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((TQueueResponse)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 requeue_result)
+ return this.equals((requeue_result)that);
+ return false;
+ }
+
+ public boolean equals(requeue_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(requeue_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("requeue_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 requeue_resultStandardSchemeFactory implements SchemeFactory {
+ public requeue_resultStandardScheme getScheme() {
+ return new requeue_resultStandardScheme();
+ }
+ }
+
+ private static class requeue_resultStandardScheme extends StandardScheme {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, requeue_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 TQueueResponse();
+ 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, requeue_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 requeue_resultTupleSchemeFactory implements SchemeFactory {
+ public requeue_resultTupleScheme getScheme() {
+ return new requeue_resultTupleScheme();
+ }
+ }
+
+ private static class requeue_resultTupleScheme extends TupleScheme {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, requeue_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, requeue_result struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ BitSet incoming = iprot.readBitSet(1);
+ if (incoming.get(0)) {
+ struct.success = new TQueueResponse();
+ struct.success.read(iprot);
+ struct.setSuccessIsSet(true);
+ }
+ }
+ }
+
+ }
+
+ public static class requeueSilent_args implements org.apache.thrift.TBase