Get RpcClient from RpcClientFactory with Reflection programming

Message or Event definition in Flum

  1. public interface Event {
  2.  
  3. /**
  4. * Returns a map of name-value pairs describing the data stored in the body.
  5. */
  6. public Map<String, String> getHeaders();
  7.  
  8. /**
  9. * Set the event headers
  10. * @param headers Map of headers to replace the current headers.
  11. */
  12. public void setHeaders(Map<String, String> headers);
  13.  
  14. /**
  15. * Returns the raw byte array of the data contained in this event.
  16. */
  17. public byte[] getBody();
  18.  
  19. /**
  20. * Sets the raw byte array of the data contained in this event.
  21. * @param body The data.
  22. */
  23. public void setBody(byte[] body);
  24.  
  25. }
  1. /**
  2. * Factory class to construct Flume {@link RPCClient} implementations.
  3. */
  4. public class RpcClientFactory {
  5.  
  6. @SuppressWarnings("unchecked")
  7. public static RpcClient getInstance(Properties properties)
  8. throws FlumeException {
  9. String type = null;
  10. type = properties.getProperty(
  11. RpcClientConfigurationConstants.CONFIG_CLIENT_TYPE);
  12. if (type == null || type.isEmpty()) {
  13. type = ClientType.DEFAULT.getClientClassName();
  14. }
  15. Class<? extends AbstractRpcClient> clazz;
  16. AbstractRpcClient client;
  17. try {
  18. String clientClassType = type;
  19. ClientType clientType = null;
  20. try {
  21. clientType = ClientType.valueOf(type.toUpperCase(Locale.ENGLISH));
  22. } catch (IllegalArgumentException e) {
  23. clientType = ClientType.OTHER;
  24. }
  25. if (!clientType.equals(ClientType.OTHER)) {
  26. clientClassType = clientType.getClientClassName();
  27. }
  28. clazz =
  29. (Class<? extends AbstractRpcClient>) Class.forName(clientClassType);
  30. } catch (ClassNotFoundException e) {
  31. throw new FlumeException("No such client!", e);
  32. }
  33.  
  34. try {
  35. client = clazz.newInstance();
  36. } catch (InstantiationException e) {
  37. throw new FlumeException("Cannot instantiate client. " +
  38. "Exception follows:", e);
  39. } catch (IllegalAccessException e) {
  40. throw new FlumeException("Cannot instantiate client. " +
  41. "Exception follows:", e);
  42. }
  43. client.configure(properties);
  44. return client;
  45.  
  46. }
  47.  
  48. public static RpcClient getThriftInstance(String hostname, Integer port, Integer batchSize) {
  49. if (hostname == null) {
  50. throw new NullPointerException("hostname must not be null");
  51. }
  52. if (port == null) {
  53. throw new NullPointerException("port must not be null");
  54. }
  55. if (batchSize == null) {
  56. throw new NullPointerException("batchSize must not be null");
  57. }
  58.  
  59. Properties props = new Properties();
  60. props.setProperty(RpcClientConfigurationConstants.CONFIG_HOSTS, "h1");
  61. props.setProperty(RpcClientConfigurationConstants.CONFIG_HOSTS_PREFIX + "h1",
  62. hostname + ":" + port.intValue());
  63. props.setProperty(RpcClientConfigurationConstants.CONFIG_BATCH_SIZE, batchSize.toString());
  64. ThriftRpcClient client = new ThriftRpcClient();
  65. client.configure(props);
  66. return client;
  67. }
  68.  
  69. public static RpcClient getThriftInstance(String hostname, Integer port) {
  70. return getThriftInstance(hostname, port, RpcClientConfigurationConstants
  71. .DEFAULT_BATCH_SIZE);
  72. }
  73.  
  74. public static RpcClient getThriftInstance(Properties props) {
  75. props.setProperty(RpcClientConfigurationConstants.CONFIG_CLIENT_TYPE,
  76. ClientType.THRIFT.clientClassName);
  77. return getInstance(props);
  78. }
  79.  
  80. public static enum ClientType {
  81. OTHER(null),
  82. DEFAULT(NettyAvroRpcClient.class.getCanonicalName()),
  83. DEFAULT_FAILOVER(FailoverRpcClient.class.getCanonicalName()),
  84. DEFAULT_LOADBALANCE(LoadBalancingRpcClient.class.getCanonicalName()),
  85. THRIFT(ThriftRpcClient.class.getCanonicalName());
  86.  
  87. private final String clientClassName;
  88.  
  89. private ClientType(String className) {
  90. this.clientClassName = className;
  91. }
  92.  
  93. protected String getClientClassName() {
  94. return this.clientClassName;
  95. }
  96.  
  97. }
  98. }

Define ThriftRpcClient implementing RpcClient

  1. public class ThriftRpcClient extends AbstractRpcClient {
  2. private ConnectionPoolManager connectionManager;
  3. private final ExecutorService callTimeoutPool;
  4. private final AtomicLong threadCounter;
  5. private final Random random = new Random();
  6. private String protocol;
  7.  
  8. private boolean enableSsl;
  9. private String truststore;
  10. private String truststorePassword;
  11. private String truststoreType;
  12. private final List<String> excludeProtocols = new LinkedList<String>();
  13.  
  14. public ThriftRpcClient() {
  15. stateLock = new ReentrantLock(true);
  16. connState = State.INIT;
  17. threadCounter = new AtomicLong(0);
  18. callTimeoutPool = Executors.newCachedThreadPool(new ThreadFactory() {
  19. @Override
  20. public Thread newThread(Runnable r) {
  21. Thread t = new Thread(r);
  22. t.setName("Flume Thrift RPC thread - " + String.valueOf(threadCounter.incrementAndGet()));
  23. return t;
  24. }
  25. });
  26. }
  27.  
  28. @Override
  29. public void append(Event event) throws EventDeliveryException {
  30. ClientWrapper client = null;
  31. boolean destroyedClient = false;
  32. try {
  33. if (!isActive()) {
  34. throw new EventDeliveryException("Client was closed due to error. " +
  35. "Please create a new client");
  36. }
  37. client = connectionManager.checkout();
  38. final ThriftFlumeEvent thriftEvent = new ThriftFlumeEvent(event.getHeaders(), ByteBuffer.wrap(event.getBody()));
  39. doAppend(client, thriftEvent).get(requestTimeout, TimeUnit.MILLISECONDS);
  40. } catch (Throwable e) {
  41. if (e instanceof ExecutionException) {
  42. Throwable cause = e.getCause();
  43. if (cause instanceof EventDeliveryException) {
  44. throw (EventDeliveryException) cause;
  45. } else if (cause instanceof TimeoutException) {
  46. throw new EventDeliveryException("Append call timeout", cause);
  47. }
  48. }
  49. destroyedClient = true;
  50. // If destroy throws, we still don't want to reuse the client, so mark it
  51. // as destroyed before we actually do.
  52. if (client != null) {
  53. connectionManager.destroy(client);
  54. }
  55. if (e instanceof Error) {
  56. throw (Error) e;
  57. } else if (e instanceof RuntimeException) {
  58. throw (RuntimeException) e;
  59. }
  60. throw new EventDeliveryException("Failed to send event. ", e);
  61. } finally {
  62. if (client != null && !destroyedClient) {
  63. connectionManager.checkIn(client);
  64. }
  65. }
  66. }
  67.  
  68. private Future<Void> doAppend(final ClientWrapper client,
  69. final ThriftFlumeEvent e) throws Exception {
  70.  
  71. return callTimeoutPool.submit(new Callable<Void>() {
  72. @Override
  73. public Void call() throws Exception {
  74. Status status = client.client.append(e);
  75. if (status != Status.OK) {
  76. throw new EventDeliveryException("Failed to deliver events. Server " +
  77. "returned status : " + status.name());
  78. }
  79. return null;
  80. }
  81. });
  82. }
  83.  
  84. private Future<Void> doAppendBatch(final ClientWrapper client,
  85. final List<ThriftFlumeEvent> e) throws Exception {
  86. return callTimeoutPool.submit(new Callable<Void>() {
  87. @Override
  88. public Void call() throws Exception {
  89. Status status = client.client.appendBatch(e);
  90. if (status != Status.OK) {
  91. throw new EventDeliveryException("Failed to deliver events. Server " +
  92. "returned status : " + status.name());
  93. }
  94. return null;
  95. }
  96. });
  97. }
  98.  
  99. @Override
  100. public boolean isActive() {
  101. stateLock.lock();
  102. try {
  103. return (connState == State.READY);
  104. } finally {
  105. stateLock.unlock();
  106. }
  107. }
  108. /**
  109. * Wrapper around a client and transport, so we can clean up when this
  110. * client gets closed.
  111. */
  112. private class ClientWrapper {
  113. public final ThriftSourceProtocol.Client client;
  114. public final TTransport transport;
  115. private final int hashCode;
  116.  
  117. public ClientWrapper() throws Exception {
  118. TSocket tsocket;
  119. if (enableSsl) {
  120. // JDK6's factory doesn't appear to pass the protocol onto the Socket
  121. // properly so we have to do some magic to make sure that happens.
  122. // Not an issue in JDK7 Lifted from thrift-0.9.1 to make the SSLContext
  123. SSLContext sslContext = createSSLContext(truststore, truststorePassword,
  124. truststoreType);
  125.  
  126. // Create the factory from it
  127. SSLSocketFactory sslSockFactory = sslContext.getSocketFactory();
  128.  
  129. // Create the TSocket from that
  130. tsocket = createSSLSocket(
  131. sslSockFactory, hostname, port, 120000, excludeProtocols);
  132. } else {
  133. tsocket = new TSocket(hostname, port);
  134. }
  135.  
  136. transport = getTransport(tsocket);
  137.  
  138. // The transport is already open for SSL as part of TSSLTransportFactory.getClientSocket
  139. if (!transport.isOpen()) {
  140. transport.open();
  141. }
  142. if (protocol.equals(BINARY_PROTOCOL)) {
  143. LOGGER.info("Using TBinaryProtocol");
  144. client = new ThriftSourceProtocol.Client(new TBinaryProtocol(transport));
  145. } else {
  146. LOGGER.info("Using TCompactProtocol");
  147. client = new ThriftSourceProtocol.Client(new TCompactProtocol(transport));
  148. }
  149. // Not a great hash code, but since this class is immutable and there
  150. // is at most one instance of the components of this class,
  151. // this works fine [If the objects are equal, hash code is the same]
  152. hashCode = random.nextInt();
  153. }
  154.  
  155. public boolean equals(Object o) {
  156. if (o == null) {
  157. return false;
  158. }
  159. // Since there is only one wrapper with any given client,
  160. // direct comparison is good enough.
  161. if (this == o) {
  162. return true;
  163. }
  164. return false;
  165. }
  166.  
  167. public int hashCode() {
  168. return hashCode;
  169. }
  170. }
  171.  
  172. private class ConnectionPoolManager {
  173. private final Queue<ClientWrapper> availableClients;
  174. private final Set<ClientWrapper> checkedOutClients;
  175. private final int maxPoolSize;
  176. private int currentPoolSize;
  177. private final Lock poolLock;
  178. private final Condition availableClientsCondition;
  179.  
  180. public ConnectionPoolManager(int poolSize) {
  181. this.maxPoolSize = poolSize;
  182. availableClients = new LinkedList<ClientWrapper>();
  183. checkedOutClients = new HashSet<ClientWrapper>();
  184. poolLock = new ReentrantLock();
  185. availableClientsCondition = poolLock.newCondition();
  186. currentPoolSize = 0;
  187. }
  188.  
  189. public ClientWrapper checkout() throws Exception {
  190.  
  191. ClientWrapper ret = null;
  192. poolLock.lock();
  193. try {
  194. if (availableClients.isEmpty() && currentPoolSize < maxPoolSize) {
  195. ret = new ClientWrapper();
  196. currentPoolSize++;
  197. checkedOutClients.add(ret);
  198. return ret;
  199. }
  200. while (availableClients.isEmpty()) {
  201. availableClientsCondition.await();
  202. }
  203. ret = availableClients.poll();
  204. checkedOutClients.add(ret);
  205. } finally {
  206. poolLock.unlock();
  207. }
  208. return ret;
  209. }
  210.  
  211. public void checkIn(ClientWrapper client) {
  212. poolLock.lock();
  213. try {
  214. availableClients.add(client);
  215. checkedOutClients.remove(client);
  216. availableClientsCondition.signal();
  217. } finally {
  218. poolLock.unlock();
  219. }
  220. }
  221.  
  222. public void destroy(ClientWrapper client) {
  223. poolLock.lock();
  224. try {
  225. checkedOutClients.remove(client);
  226. currentPoolSize--;
  227. } finally {
  228. poolLock.unlock();
  229. }
  230. client.transport.close();
  231. }
  232.  
  233. public void closeAll() {
  234. poolLock.lock();
  235. try {
  236. for (ClientWrapper c : availableClients) {
  237. c.transport.close();
  238. currentPoolSize--;
  239. }
  240. for (ClientWrapper c : checkedOutClients) {
  241. c.transport.close();
  242. currentPoolSize--;
  243. }
  244. } finally {
  245. poolLock.unlock();
  246. }
  247. }
  248. }
  249. private static SSLContext createSSLContext(String truststore,
  250. String truststorePassword,
  251. String truststoreType) throws FlumeException {
  252. SSLContext ctx;
  253. try {
  254. ctx = SSLContext.getInstance("TLS");
  255. TrustManagerFactory tmf;
  256. tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
  257. KeyStore ts = null;
  258. if (truststore != null && truststoreType != null) {
  259. ts = KeyStore.getInstance(truststoreType);
  260. ts.load(new FileInputStream(truststore), truststorePassword.toCharArray());
  261. tmf.init(ts);
  262. }
  263.  
  264. tmf.init(ts);
  265. ctx.init(null, tmf.getTrustManagers(), null);
  266.  
  267. } catch (Exception e) {
  268. throw new FlumeException("Error creating the transport", e);
  269. }
  270. return ctx;
  271. }
  272. private static TSocket createSSLSocket(SSLSocketFactory factory, String host,
  273. int port, int timeout, List<String> excludeProtocols)
  274. throws FlumeException {
  275. try {
  276. SSLSocket socket = (SSLSocket) factory.createSocket(host, port);
  277. socket.setSoTimeout(timeout);
  278.  
  279. List<String> enabledProtocols = new ArrayList<String>();
  280. for (String protocol : socket.getEnabledProtocols()) {
  281. if (!excludeProtocols.contains(protocol)) {
  282. enabledProtocols.add(protocol);
  283. }
  284. }
  285. socket.setEnabledProtocols(enabledProtocols.toArray(new String[0]));
  286. return new TSocket(socket);
  287. } catch (Exception e) {
  288. throw new FlumeException("Could not connect to " + host + " on port " + port, e);
  289. }
  290. }
  291. }

Now we look at ThriftSourceProtocol

  1. public static class Client extends org.apache.thrift.TServiceClient implements Iface {
  2. public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
  3. public Factory() {}
  4. public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
  5. return new Client(prot);
  6. }
  7. public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
  8. return new Client(iprot, oprot);
  9. }
  10. }
  11. }
  1. public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
  2. public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
  3. private org.apache.thrift.async.TAsyncClientManager clientManager;
  4. private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
  5. public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
  6. this.clientManager = clientManager;
  7. this.protocolFactory = protocolFactory;
  8. }
  9. public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
  10. return new AsyncClient(protocolFactory, clientManager, transport);
  11. }
  12. }
  13. ..................................
  14. }
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. /**
  20. * Autogenerated by Thrift Compiler (0.7.0)
  21. *
  22. * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
  23. */
  24. package org.apache.flume.thrift;
  25.  
  26. import org.apache.commons.lang.builder.HashCodeBuilder;
  27. import java.util.List;
  28. import java.util.ArrayList;
  29. import java.util.Map;
  30. import java.util.HashMap;
  31. import java.util.EnumMap;
  32. import java.util.Set;
  33. import java.util.HashSet;
  34. import java.util.EnumSet;
  35. import java.util.Collections;
  36. import java.util.BitSet;
  37. import java.nio.ByteBuffer;
  38. import java.util.Arrays;
  39. import org.slf4j.Logger;
  40. import org.slf4j.LoggerFactory;
  41.  
  42. public class ThriftSourceProtocol {
  43.  
  44. public interface Iface {
  45.  
  46. public Status append(ThriftFlumeEvent event) throws org.apache.thrift.TException;
  47.  
  48. public Status appendBatch(List<ThriftFlumeEvent> events) throws org.apache.thrift.TException;
  49.  
  50. }
  51.  
  52. public interface AsyncIface {
  53.  
  54. public void append(ThriftFlumeEvent event, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.append_call> resultHandler) throws org.apache.thrift.TException;
  55.  
  56. public void appendBatch(List<ThriftFlumeEvent> events, org.apache.thrift.async.AsyncMethodCallback<AsyncClient.appendBatch_call> resultHandler) throws org.apache.thrift.TException;
  57.  
  58. }
  59.  
  60. public static class Client extends org.apache.thrift.TServiceClient implements Iface {
  61. public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
  62. public Factory() {}
  63. public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
  64. return new Client(prot);
  65. }
  66. public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
  67. return new Client(iprot, oprot);
  68. }
  69. }
  70.  
  71. public Client(org.apache.thrift.protocol.TProtocol prot)
  72. {
  73. super(prot, prot);
  74. }
  75.  
  76. public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
  77. super(iprot, oprot);
  78. }
  79.  
  80. public Status append(ThriftFlumeEvent event) throws org.apache.thrift.TException
  81. {
  82. send_append(event);
  83. return recv_append();
  84. }
  85.  
  86. public void send_append(ThriftFlumeEvent event) throws org.apache.thrift.TException
  87. {
  88. append_args args = new append_args();
  89. args.setEvent(event);
  90. sendBase("append", args);
  91. }
  92.  
  93. public Status recv_append() throws org.apache.thrift.TException
  94. {
  95. append_result result = new append_result();
  96. receiveBase(result, "append");
  97. if (result.isSetSuccess()) {
  98. return result.success;
  99. }
  100. throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "append failed: unknown result");
  101. }
  102.  
  103. public Status appendBatch(List<ThriftFlumeEvent> events) throws org.apache.thrift.TException
  104. {
  105. send_appendBatch(events);
  106. return recv_appendBatch();
  107. }
  108.  
  109. public void send_appendBatch(List<ThriftFlumeEvent> events) throws org.apache.thrift.TException
  110. {
  111. appendBatch_args args = new appendBatch_args();
  112. args.setEvents(events);
  113. sendBase("appendBatch", args);
  114. }
  115.  
  116. public Status recv_appendBatch() throws org.apache.thrift.TException
  117. {
  118. appendBatch_result result = new appendBatch_result();
  119. receiveBase(result, "appendBatch");
  120. if (result.isSetSuccess()) {
  121. return result.success;
  122. }
  123. throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "appendBatch failed: unknown result");
  124. }
  125.  
  126. }
  127. public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
  128. public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
  129. private org.apache.thrift.async.TAsyncClientManager clientManager;
  130. private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
  131. public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
  132. this.clientManager = clientManager;
  133. this.protocolFactory = protocolFactory;
  134. }
  135. public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
  136. return new AsyncClient(protocolFactory, clientManager, transport);
  137. }
  138. }
  139.  
  140. public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
  141. super(protocolFactory, clientManager, transport);
  142. }
  143.  
  144. public void append(ThriftFlumeEvent event, org.apache.thrift.async.AsyncMethodCallback<append_call> resultHandler) throws org.apache.thrift.TException {
  145. checkReady();
  146. append_call method_call = new append_call(event, resultHandler, this, ___protocolFactory, ___transport);
  147. this.___currentMethod = method_call;
  148. ___manager.call(method_call);
  149. }
  150.  
  151. public static class append_call extends org.apache.thrift.async.TAsyncMethodCall {
  152. private ThriftFlumeEvent event;
  153. public append_call(ThriftFlumeEvent event, org.apache.thrift.async.AsyncMethodCallback<append_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
  154. super(client, protocolFactory, transport, resultHandler, false);
  155. this.event = event;
  156. }
  157.  
  158. public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
  159. prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("append", org.apache.thrift.protocol.TMessageType.CALL, 0));
  160. append_args args = new append_args();
  161. args.setEvent(event);
  162. args.write(prot);
  163. prot.writeMessageEnd();
  164. }
  165.  
  166. public Status getResult() throws org.apache.thrift.TException {
  167. if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
  168. throw new IllegalStateException("Method call not finished!");
  169. }
  170. org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
  171. org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
  172. return (new Client(prot)).recv_append();
  173. }
  174. }
  175.  
  176. public void appendBatch(List<ThriftFlumeEvent> events, org.apache.thrift.async.AsyncMethodCallback<appendBatch_call> resultHandler) throws org.apache.thrift.TException {
  177. checkReady();
  178. appendBatch_call method_call = new appendBatch_call(events, resultHandler, this, ___protocolFactory, ___transport);
  179. this.___currentMethod = method_call;
  180. ___manager.call(method_call);
  181. }
  182.  
  183. public static class appendBatch_call extends org.apache.thrift.async.TAsyncMethodCall {
  184. private List<ThriftFlumeEvent> events;
  185. public appendBatch_call(List<ThriftFlumeEvent> events, org.apache.thrift.async.AsyncMethodCallback<appendBatch_call> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
  186. super(client, protocolFactory, transport, resultHandler, false);
  187. this.events = events;
  188. }
  189.  
  190. public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
  191. prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("appendBatch", org.apache.thrift.protocol.TMessageType.CALL, 0));
  192. appendBatch_args args = new appendBatch_args();
  193. args.setEvents(events);
  194. args.write(prot);
  195. prot.writeMessageEnd();
  196. }
  197.  
  198. public Status getResult() throws org.apache.thrift.TException {
  199. if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
  200. throw new IllegalStateException("Method call not finished!");
  201. }
  202. org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
  203. org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
  204. return (new Client(prot)).recv_appendBatch();
  205. }
  206. }
  207.  
  208. }
  209.  
  210. public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor implements org.apache.thrift.TProcessor {
  211. private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
  212. public Processor(I iface) {
  213. super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
  214. }
  215.  
  216. protected Processor(I iface, Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
  217. super(iface, getProcessMap(processMap));
  218. }
  219.  
  220. private static <I extends Iface> Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> getProcessMap(Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
  221. processMap.put("append", new append());
  222. processMap.put("appendBatch", new appendBatch());
  223. return processMap;
  224. }
  225.  
  226. private static class append<I extends Iface> extends org.apache.thrift.ProcessFunction<I, append_args> {
  227. public append() {
  228. super("append");
  229. }
  230.  
  231. public append_args getEmptyArgsInstance() {
  232. return new append_args();
  233. }
  234.  
  235. public append_result getResult(I iface, append_args args) throws org
  236. .apache.thrift.TException {
  237. append_result result = new append_result();
  238. result.success = iface.append(args.event);
  239. return result;
  240. }
  241.  
  242. protected boolean isOneway() {
  243. return false;
  244. }
  245. }
  246.  
  247. private static class appendBatch<I extends Iface> extends org.apache.thrift.ProcessFunction<I, appendBatch_args> {
  248. public appendBatch() {
  249. super("appendBatch");
  250. }
  251.  
  252. public appendBatch_args getEmptyArgsInstance() {
  253. return new appendBatch_args();
  254. }
  255.  
  256. public appendBatch_result getResult(I iface, appendBatch_args args)
  257. throws org.apache.thrift.TException {
  258. appendBatch_result result = new appendBatch_result();
  259. result.success = iface.appendBatch(args.events);
  260. return result;
  261. }
  262.  
  263. protected boolean isOneway() {
  264. return false;
  265. }
  266. }
  267.  
  268. }
  269.  
  270. public static class append_args implements org.apache.thrift.TBase<append_args, append_args._Fields>, java.io.Serializable, Cloneable {
  271. private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("append_args");
  272.  
  273. private static final org.apache.thrift.protocol.TField EVENT_FIELD_DESC = new org.apache.thrift.protocol.TField("event", org.apache.thrift.protocol.TType.STRUCT, (short)1);
  274.  
  275. public ThriftFlumeEvent event; // required
  276.  
  277. /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  278. public enum _Fields implements org.apache.thrift.TFieldIdEnum {
  279. EVENT((short)1, "event");
  280.  
  281. private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
  282.  
  283. static {
  284. for (_Fields field : EnumSet.allOf(_Fields.class)) {
  285. byName.put(field.getFieldName(), field);
  286. }
  287. }
  288.  
  289. /**
  290. * Find the _Fields constant that matches fieldId, or null if its not found.
  291. */
  292. public static _Fields findByThriftId(int fieldId) {
  293. switch(fieldId) {
  294. case 1: // EVENT
  295. return EVENT;
  296. default:
  297. return null;
  298. }
  299. }
  300.  
  301. /**
  302. * Find the _Fields constant that matches fieldId, throwing an exception
  303. * if it is not found.
  304. */
  305. public static _Fields findByThriftIdOrThrow(int fieldId) {
  306. _Fields fields = findByThriftId(fieldId);
  307. if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
  308. return fields;
  309. }
  310.  
  311. /**
  312. * Find the _Fields constant that matches name, or null if its not found.
  313. */
  314. public static _Fields findByName(String name) {
  315. return byName.get(name);
  316. }
  317.  
  318. private final short _thriftId;
  319. private final String _fieldName;
  320.  
  321. _Fields(short thriftId, String fieldName) {
  322. _thriftId = thriftId;
  323. _fieldName = fieldName;
  324. }
  325.  
  326. public short getThriftFieldId() {
  327. return _thriftId;
  328. }
  329.  
  330. public String getFieldName() {
  331. return _fieldName;
  332. }
  333. }
  334.  
  335. // isset id assignments
  336.  
  337. public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  338. static {
  339. Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
  340. tmpMap.put(_Fields.EVENT, new org.apache.thrift.meta_data.FieldMetaData("event", org.apache.thrift.TFieldRequirementType.DEFAULT,
  341. new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ThriftFlumeEvent.class)));
  342. metaDataMap = Collections.unmodifiableMap(tmpMap);
  343. org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(append_args.class, metaDataMap);
  344. }
  345.  
  346. public append_args() {
  347. }
  348.  
  349. public append_args(
  350. ThriftFlumeEvent event)
  351. {
  352. this();
  353. this.event = event;
  354. }
  355.  
  356. /**
  357. * Performs a deep copy on <i>other</i>.
  358. */
  359. public append_args(append_args other) {
  360. if (other.isSetEvent()) {
  361. this.event = new ThriftFlumeEvent(other.event);
  362. }
  363. }
  364.  
  365. public append_args deepCopy() {
  366. return new append_args(this);
  367. }
  368.  
  369. @Override
  370. public void clear() {
  371. this.event = null;
  372. }
  373.  
  374. public ThriftFlumeEvent getEvent() {
  375. return this.event;
  376. }
  377.  
  378. public append_args setEvent(ThriftFlumeEvent event) {
  379. this.event = event;
  380. return this;
  381. }
  382.  
  383. public void unsetEvent() {
  384. this.event = null;
  385. }
  386.  
  387. /** Returns true if field event is set (has been assigned a value) and false otherwise */
  388. public boolean isSetEvent() {
  389. return this.event != null;
  390. }
  391.  
  392. public void setEventIsSet(boolean value) {
  393. if (!value) {
  394. this.event = null;
  395. }
  396. }
  397.  
  398. public void setFieldValue(_Fields field, Object value) {
  399. switch (field) {
  400. case EVENT:
  401. if (value == null) {
  402. unsetEvent();
  403. } else {
  404. setEvent((ThriftFlumeEvent)value);
  405. }
  406. break;
  407.  
  408. }
  409. }
  410.  
  411. public Object getFieldValue(_Fields field) {
  412. switch (field) {
  413. case EVENT:
  414. return getEvent();
  415.  
  416. }
  417. throw new IllegalStateException();
  418. }
  419.  
  420. /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  421. public boolean isSet(_Fields field) {
  422. if (field == null) {
  423. throw new IllegalArgumentException();
  424. }
  425.  
  426. switch (field) {
  427. case EVENT:
  428. return isSetEvent();
  429. }
  430. throw new IllegalStateException();
  431. }
  432.  
  433. @Override
  434. public boolean equals(Object that) {
  435. if (that == null)
  436. return false;
  437. if (that instanceof append_args)
  438. return this.equals((append_args)that);
  439. return false;
  440. }
  441.  
  442. public boolean equals(append_args that) {
  443. if (that == null)
  444. return false;
  445.  
  446. boolean this_present_event = true && this.isSetEvent();
  447. boolean that_present_event = true && that.isSetEvent();
  448. if (this_present_event || that_present_event) {
  449. if (!(this_present_event && that_present_event))
  450. return false;
  451. if (!this.event.equals(that.event))
  452. return false;
  453. }
  454.  
  455. return true;
  456. }
  457.  
  458. @Override
  459. public int hashCode() {
  460. HashCodeBuilder builder = new HashCodeBuilder();
  461.  
  462. boolean present_event = true && (isSetEvent());
  463. builder.append(present_event);
  464. if (present_event)
  465. builder.append(event);
  466.  
  467. return builder.toHashCode();
  468. }
  469.  
  470. public int compareTo(append_args other) {
  471. if (!getClass().equals(other.getClass())) {
  472. return getClass().getName().compareTo(other.getClass().getName());
  473. }
  474.  
  475. int lastComparison = 0;
  476. append_args typedOther = (append_args)other;
  477.  
  478. lastComparison = Boolean.valueOf(isSetEvent()).compareTo(typedOther.isSetEvent());
  479. if (lastComparison != 0) {
  480. return lastComparison;
  481. }
  482. if (isSetEvent()) {
  483. lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.event, typedOther.event);
  484. if (lastComparison != 0) {
  485. return lastComparison;
  486. }
  487. }
  488. return 0;
  489. }
  490.  
  491. public _Fields fieldForId(int fieldId) {
  492. return _Fields.findByThriftId(fieldId);
  493. }
  494.  
  495. public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
  496. org.apache.thrift.protocol.TField field;
  497. iprot.readStructBegin();
  498. while (true)
  499. {
  500. field = iprot.readFieldBegin();
  501. if (field.type == org.apache.thrift.protocol.TType.STOP) {
  502. break;
  503. }
  504. switch (field.id) {
  505. case 1: // EVENT
  506. if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
  507. this.event = new ThriftFlumeEvent();
  508. this.event.read(iprot);
  509. } else {
  510. org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
  511. }
  512. break;
  513. default:
  514. org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
  515. }
  516. iprot.readFieldEnd();
  517. }
  518. iprot.readStructEnd();
  519.  
  520. // check for required fields of primitive type, which can't be checked in the validate method
  521. validate();
  522. }
  523.  
  524. public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
  525. validate();
  526.  
  527. oprot.writeStructBegin(STRUCT_DESC);
  528. if (this.event != null) {
  529. oprot.writeFieldBegin(EVENT_FIELD_DESC);
  530. this.event.write(oprot);
  531. oprot.writeFieldEnd();
  532. }
  533. oprot.writeFieldStop();
  534. oprot.writeStructEnd();
  535. }
  536.  
  537. @Override
  538. public String toString() {
  539. StringBuilder sb = new StringBuilder("append_args(");
  540. boolean first = true;
  541.  
  542. sb.append("event:");
  543. if (this.event == null) {
  544. sb.append("null");
  545. } else {
  546. sb.append(this.event);
  547. }
  548. first = false;
  549. sb.append(")");
  550. return sb.toString();
  551. }
  552.  
  553. public void validate() throws org.apache.thrift.TException {
  554. // check for required fields
  555. }
  556.  
  557. private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
  558. try {
  559. write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
  560. } catch (org.apache.thrift.TException te) {
  561. throw new java.io.IOException(te);
  562. }
  563. }
  564.  
  565. private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
  566. try {
  567. read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
  568. } catch (org.apache.thrift.TException te) {
  569. throw new java.io.IOException(te);
  570. }
  571. }
  572.  
  573. }
  574.  
  575. public static class append_result implements org.apache.thrift.TBase<append_result, append_result._Fields>, java.io.Serializable, Cloneable {
  576. private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("append_result");
  577.  
  578. private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0);
  579.  
  580. /**
  581. *
  582. * @see Status
  583. */
  584. public Status success; // required
  585.  
  586. /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  587. public enum _Fields implements org.apache.thrift.TFieldIdEnum {
  588. /**
  589. *
  590. * @see Status
  591. */
  592. SUCCESS((short)0, "success");
  593.  
  594. private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
  595.  
  596. static {
  597. for (_Fields field : EnumSet.allOf(_Fields.class)) {
  598. byName.put(field.getFieldName(), field);
  599. }
  600. }
  601.  
  602. /**
  603. * Find the _Fields constant that matches fieldId, or null if its not found.
  604. */
  605. public static _Fields findByThriftId(int fieldId) {
  606. switch(fieldId) {
  607. case 0: // SUCCESS
  608. return SUCCESS;
  609. default:
  610. return null;
  611. }
  612. }
  613.  
  614. /**
  615. * Find the _Fields constant that matches fieldId, throwing an exception
  616. * if it is not found.
  617. */
  618. public static _Fields findByThriftIdOrThrow(int fieldId) {
  619. _Fields fields = findByThriftId(fieldId);
  620. if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
  621. return fields;
  622. }
  623.  
  624. /**
  625. * Find the _Fields constant that matches name, or null if its not found.
  626. */
  627. public static _Fields findByName(String name) {
  628. return byName.get(name);
  629. }
  630.  
  631. private final short _thriftId;
  632. private final String _fieldName;
  633.  
  634. _Fields(short thriftId, String fieldName) {
  635. _thriftId = thriftId;
  636. _fieldName = fieldName;
  637. }
  638.  
  639. public short getThriftFieldId() {
  640. return _thriftId;
  641. }
  642.  
  643. public String getFieldName() {
  644. return _fieldName;
  645. }
  646. }
  647.  
  648. // isset id assignments
  649.  
  650. public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  651. static {
  652. Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
  653. tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
  654. new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, Status.class)));
  655. metaDataMap = Collections.unmodifiableMap(tmpMap);
  656. org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(append_result.class, metaDataMap);
  657. }
  658.  
  659. public append_result() {
  660. }
  661.  
  662. public append_result(
  663. Status success)
  664. {
  665. this();
  666. this.success = success;
  667. }
  668.  
  669. /**
  670. * Performs a deep copy on <i>other</i>.
  671. */
  672. public append_result(append_result other) {
  673. if (other.isSetSuccess()) {
  674. this.success = other.success;
  675. }
  676. }
  677.  
  678. public append_result deepCopy() {
  679. return new append_result(this);
  680. }
  681.  
  682. @Override
  683. public void clear() {
  684. this.success = null;
  685. }
  686.  
  687. /**
  688. *
  689. * @see Status
  690. */
  691. public Status getSuccess() {
  692. return this.success;
  693. }
  694.  
  695. /**
  696. *
  697. * @see Status
  698. */
  699. public append_result setSuccess(Status success) {
  700. this.success = success;
  701. return this;
  702. }
  703.  
  704. public void unsetSuccess() {
  705. this.success = null;
  706. }
  707.  
  708. /** Returns true if field success is set (has been assigned a value) and false otherwise */
  709. public boolean isSetSuccess() {
  710. return this.success != null;
  711. }
  712.  
  713. public void setSuccessIsSet(boolean value) {
  714. if (!value) {
  715. this.success = null;
  716. }
  717. }
  718.  
  719. public void setFieldValue(_Fields field, Object value) {
  720. switch (field) {
  721. case SUCCESS:
  722. if (value == null) {
  723. unsetSuccess();
  724. } else {
  725. setSuccess((Status)value);
  726. }
  727. break;
  728.  
  729. }
  730. }
  731.  
  732. public Object getFieldValue(_Fields field) {
  733. switch (field) {
  734. case SUCCESS:
  735. return getSuccess();
  736.  
  737. }
  738. throw new IllegalStateException();
  739. }
  740.  
  741. /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  742. public boolean isSet(_Fields field) {
  743. if (field == null) {
  744. throw new IllegalArgumentException();
  745. }
  746.  
  747. switch (field) {
  748. case SUCCESS:
  749. return isSetSuccess();
  750. }
  751. throw new IllegalStateException();
  752. }
  753.  
  754. @Override
  755. public boolean equals(Object that) {
  756. if (that == null)
  757. return false;
  758. if (that instanceof append_result)
  759. return this.equals((append_result)that);
  760. return false;
  761. }
  762.  
  763. public boolean equals(append_result that) {
  764. if (that == null)
  765. return false;
  766.  
  767. boolean this_present_success = true && this.isSetSuccess();
  768. boolean that_present_success = true && that.isSetSuccess();
  769. if (this_present_success || that_present_success) {
  770. if (!(this_present_success && that_present_success))
  771. return false;
  772. if (!this.success.equals(that.success))
  773. return false;
  774. }
  775.  
  776. return true;
  777. }
  778.  
  779. @Override
  780. public int hashCode() {
  781. HashCodeBuilder builder = new HashCodeBuilder();
  782.  
  783. boolean present_success = true && (isSetSuccess());
  784. builder.append(present_success);
  785. if (present_success)
  786. builder.append(success.getValue());
  787.  
  788. return builder.toHashCode();
  789. }
  790.  
  791. public int compareTo(append_result other) {
  792. if (!getClass().equals(other.getClass())) {
  793. return getClass().getName().compareTo(other.getClass().getName());
  794. }
  795.  
  796. int lastComparison = 0;
  797. append_result typedOther = (append_result)other;
  798.  
  799. lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
  800. if (lastComparison != 0) {
  801. return lastComparison;
  802. }
  803. if (isSetSuccess()) {
  804. lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
  805. if (lastComparison != 0) {
  806. return lastComparison;
  807. }
  808. }
  809. return 0;
  810. }
  811.  
  812. public _Fields fieldForId(int fieldId) {
  813. return _Fields.findByThriftId(fieldId);
  814. }
  815.  
  816. public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
  817. org.apache.thrift.protocol.TField field;
  818. iprot.readStructBegin();
  819. while (true)
  820. {
  821. field = iprot.readFieldBegin();
  822. if (field.type == org.apache.thrift.protocol.TType.STOP) {
  823. break;
  824. }
  825. switch (field.id) {
  826. case 0: // SUCCESS
  827. if (field.type == org.apache.thrift.protocol.TType.I32) {
  828. this.success = Status.findByValue(iprot.readI32());
  829. } else {
  830. org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
  831. }
  832. break;
  833. default:
  834. org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
  835. }
  836. iprot.readFieldEnd();
  837. }
  838. iprot.readStructEnd();
  839.  
  840. // check for required fields of primitive type, which can't be checked in the validate method
  841. validate();
  842. }
  843.  
  844. public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
  845. oprot.writeStructBegin(STRUCT_DESC);
  846.  
  847. if (this.isSetSuccess()) {
  848. oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
  849. oprot.writeI32(this.success.getValue());
  850. oprot.writeFieldEnd();
  851. }
  852. oprot.writeFieldStop();
  853. oprot.writeStructEnd();
  854. }
  855.  
  856. @Override
  857. public String toString() {
  858. StringBuilder sb = new StringBuilder("append_result(");
  859. boolean first = true;
  860.  
  861. sb.append("success:");
  862. if (this.success == null) {
  863. sb.append("null");
  864. } else {
  865. sb.append(this.success);
  866. }
  867. first = false;
  868. sb.append(")");
  869. return sb.toString();
  870. }
  871.  
  872. public void validate() throws org.apache.thrift.TException {
  873. // check for required fields
  874. }
  875.  
  876. private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
  877. try {
  878. write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
  879. } catch (org.apache.thrift.TException te) {
  880. throw new java.io.IOException(te);
  881. }
  882. }
  883.  
  884. private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
  885. try {
  886. read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
  887. } catch (org.apache.thrift.TException te) {
  888. throw new java.io.IOException(te);
  889. }
  890. }
  891.  
  892. }
  893.  
  894. public static class appendBatch_args implements org.apache.thrift.TBase<appendBatch_args, appendBatch_args._Fields>, java.io.Serializable, Cloneable {
  895. private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("appendBatch_args");
  896.  
  897. private static final org.apache.thrift.protocol.TField EVENTS_FIELD_DESC = new org.apache.thrift.protocol.TField("events", org.apache.thrift.protocol.TType.LIST, (short)1);
  898.  
  899. public List<ThriftFlumeEvent> events; // required
  900.  
  901. /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  902. public enum _Fields implements org.apache.thrift.TFieldIdEnum {
  903. EVENTS((short)1, "events");
  904.  
  905. private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
  906.  
  907. static {
  908. for (_Fields field : EnumSet.allOf(_Fields.class)) {
  909. byName.put(field.getFieldName(), field);
  910. }
  911. }
  912.  
  913. /**
  914. * Find the _Fields constant that matches fieldId, or null if its not found.
  915. */
  916. public static _Fields findByThriftId(int fieldId) {
  917. switch(fieldId) {
  918. case 1: // EVENTS
  919. return EVENTS;
  920. default:
  921. return null;
  922. }
  923. }
  924.  
  925. /**
  926. * Find the _Fields constant that matches fieldId, throwing an exception
  927. * if it is not found.
  928. */
  929. public static _Fields findByThriftIdOrThrow(int fieldId) {
  930. _Fields fields = findByThriftId(fieldId);
  931. if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
  932. return fields;
  933. }
  934.  
  935. /**
  936. * Find the _Fields constant that matches name, or null if its not found.
  937. */
  938. public static _Fields findByName(String name) {
  939. return byName.get(name);
  940. }
  941.  
  942. private final short _thriftId;
  943. private final String _fieldName;
  944.  
  945. _Fields(short thriftId, String fieldName) {
  946. _thriftId = thriftId;
  947. _fieldName = fieldName;
  948. }
  949.  
  950. public short getThriftFieldId() {
  951. return _thriftId;
  952. }
  953.  
  954. public String getFieldName() {
  955. return _fieldName;
  956. }
  957. }
  958.  
  959. // isset id assignments
  960.  
  961. public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  962. static {
  963. Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
  964. tmpMap.put(_Fields.EVENTS, new org.apache.thrift.meta_data.FieldMetaData("events", org.apache.thrift.TFieldRequirementType.DEFAULT,
  965. new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
  966. new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ThriftFlumeEvent.class))));
  967. metaDataMap = Collections.unmodifiableMap(tmpMap);
  968. org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(appendBatch_args.class, metaDataMap);
  969. }
  970.  
  971. public appendBatch_args() {
  972. }
  973.  
  974. public appendBatch_args(
  975. List<ThriftFlumeEvent> events)
  976. {
  977. this();
  978. this.events = events;
  979. }
  980.  
  981. /**
  982. * Performs a deep copy on <i>other</i>.
  983. */
  984. public appendBatch_args(appendBatch_args other) {
  985. if (other.isSetEvents()) {
  986. List<ThriftFlumeEvent> __this__events = new ArrayList<ThriftFlumeEvent>();
  987. for (ThriftFlumeEvent other_element : other.events) {
  988. __this__events.add(new ThriftFlumeEvent(other_element));
  989. }
  990. this.events = __this__events;
  991. }
  992. }
  993.  
  994. public appendBatch_args deepCopy() {
  995. return new appendBatch_args(this);
  996. }
  997.  
  998. @Override
  999. public void clear() {
  1000. this.events = null;
  1001. }
  1002.  
  1003. public int getEventsSize() {
  1004. return (this.events == null) ? 0 : this.events.size();
  1005. }
  1006.  
  1007. public java.util.Iterator<ThriftFlumeEvent> getEventsIterator() {
  1008. return (this.events == null) ? null : this.events.iterator();
  1009. }
  1010.  
  1011. public void addToEvents(ThriftFlumeEvent elem) {
  1012. if (this.events == null) {
  1013. this.events = new ArrayList<ThriftFlumeEvent>();
  1014. }
  1015. this.events.add(elem);
  1016. }
  1017.  
  1018. public List<ThriftFlumeEvent> getEvents() {
  1019. return this.events;
  1020. }
  1021.  
  1022. public appendBatch_args setEvents(List<ThriftFlumeEvent> events) {
  1023. this.events = events;
  1024. return this;
  1025. }
  1026.  
  1027. public void unsetEvents() {
  1028. this.events = null;
  1029. }
  1030.  
  1031. /** Returns true if field events is set (has been assigned a value) and false otherwise */
  1032. public boolean isSetEvents() {
  1033. return this.events != null;
  1034. }
  1035.  
  1036. public void setEventsIsSet(boolean value) {
  1037. if (!value) {
  1038. this.events = null;
  1039. }
  1040. }
  1041.  
  1042. public void setFieldValue(_Fields field, Object value) {
  1043. switch (field) {
  1044. case EVENTS:
  1045. if (value == null) {
  1046. unsetEvents();
  1047. } else {
  1048. setEvents((List<ThriftFlumeEvent>)value);
  1049. }
  1050. break;
  1051.  
  1052. }
  1053. }
  1054.  
  1055. public Object getFieldValue(_Fields field) {
  1056. switch (field) {
  1057. case EVENTS:
  1058. return getEvents();
  1059.  
  1060. }
  1061. throw new IllegalStateException();
  1062. }
  1063.  
  1064. /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  1065. public boolean isSet(_Fields field) {
  1066. if (field == null) {
  1067. throw new IllegalArgumentException();
  1068. }
  1069.  
  1070. switch (field) {
  1071. case EVENTS:
  1072. return isSetEvents();
  1073. }
  1074. throw new IllegalStateException();
  1075. }
  1076.  
  1077. @Override
  1078. public boolean equals(Object that) {
  1079. if (that == null)
  1080. return false;
  1081. if (that instanceof appendBatch_args)
  1082. return this.equals((appendBatch_args)that);
  1083. return false;
  1084. }
  1085.  
  1086. public boolean equals(appendBatch_args that) {
  1087. if (that == null)
  1088. return false;
  1089.  
  1090. boolean this_present_events = true && this.isSetEvents();
  1091. boolean that_present_events = true && that.isSetEvents();
  1092. if (this_present_events || that_present_events) {
  1093. if (!(this_present_events && that_present_events))
  1094. return false;
  1095. if (!this.events.equals(that.events))
  1096. return false;
  1097. }
  1098.  
  1099. return true;
  1100. }
  1101.  
  1102. @Override
  1103. public int hashCode() {
  1104. HashCodeBuilder builder = new HashCodeBuilder();
  1105.  
  1106. boolean present_events = true && (isSetEvents());
  1107. builder.append(present_events);
  1108. if (present_events)
  1109. builder.append(events);
  1110.  
  1111. return builder.toHashCode();
  1112. }
  1113.  
  1114. public int compareTo(appendBatch_args other) {
  1115. if (!getClass().equals(other.getClass())) {
  1116. return getClass().getName().compareTo(other.getClass().getName());
  1117. }
  1118.  
  1119. int lastComparison = 0;
  1120. appendBatch_args typedOther = (appendBatch_args)other;
  1121.  
  1122. lastComparison = Boolean.valueOf(isSetEvents()).compareTo(typedOther.isSetEvents());
  1123. if (lastComparison != 0) {
  1124. return lastComparison;
  1125. }
  1126. if (isSetEvents()) {
  1127. lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.events, typedOther.events);
  1128. if (lastComparison != 0) {
  1129. return lastComparison;
  1130. }
  1131. }
  1132. return 0;
  1133. }
  1134.  
  1135. public _Fields fieldForId(int fieldId) {
  1136. return _Fields.findByThriftId(fieldId);
  1137. }
  1138.  
  1139. public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
  1140. org.apache.thrift.protocol.TField field;
  1141. iprot.readStructBegin();
  1142. while (true)
  1143. {
  1144. field = iprot.readFieldBegin();
  1145. if (field.type == org.apache.thrift.protocol.TType.STOP) {
  1146. break;
  1147. }
  1148. switch (field.id) {
  1149. case 1: // EVENTS
  1150. if (field.type == org.apache.thrift.protocol.TType.LIST) {
  1151. {
  1152. org.apache.thrift.protocol.TList _list5 = iprot.readListBegin();
  1153. this.events = new ArrayList<ThriftFlumeEvent>(_list5.size);
  1154. for (int _i6 = 0; _i6 < _list5.size; ++_i6)
  1155. {
  1156. ThriftFlumeEvent _elem7; // required
  1157. _elem7 = new ThriftFlumeEvent();
  1158. _elem7.read(iprot);
  1159. this.events.add(_elem7);
  1160. }
  1161. iprot.readListEnd();
  1162. }
  1163. } else {
  1164. org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
  1165. }
  1166. break;
  1167. default:
  1168. org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
  1169. }
  1170. iprot.readFieldEnd();
  1171. }
  1172. iprot.readStructEnd();
  1173.  
  1174. // check for required fields of primitive type, which can't be checked in the validate method
  1175. validate();
  1176. }
  1177.  
  1178. public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
  1179. validate();
  1180.  
  1181. oprot.writeStructBegin(STRUCT_DESC);
  1182. if (this.events != null) {
  1183. oprot.writeFieldBegin(EVENTS_FIELD_DESC);
  1184. {
  1185. oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.events.size()));
  1186. for (ThriftFlumeEvent _iter8 : this.events)
  1187. {
  1188. _iter8.write(oprot);
  1189. }
  1190. oprot.writeListEnd();
  1191. }
  1192. oprot.writeFieldEnd();
  1193. }
  1194. oprot.writeFieldStop();
  1195. oprot.writeStructEnd();
  1196. }
  1197.  
  1198. @Override
  1199. public String toString() {
  1200. StringBuilder sb = new StringBuilder("appendBatch_args(");
  1201. boolean first = true;
  1202.  
  1203. sb.append("events:");
  1204. if (this.events == null) {
  1205. sb.append("null");
  1206. } else {
  1207. sb.append(this.events);
  1208. }
  1209. first = false;
  1210. sb.append(")");
  1211. return sb.toString();
  1212. }
  1213.  
  1214. public void validate() throws org.apache.thrift.TException {
  1215. // check for required fields
  1216. }
  1217.  
  1218. private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
  1219. try {
  1220. write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
  1221. } catch (org.apache.thrift.TException te) {
  1222. throw new java.io.IOException(te);
  1223. }
  1224. }
  1225.  
  1226. private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
  1227. try {
  1228. read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
  1229. } catch (org.apache.thrift.TException te) {
  1230. throw new java.io.IOException(te);
  1231. }
  1232. }
  1233.  
  1234. }
  1235.  
  1236. public static class appendBatch_result implements org.apache.thrift.TBase<appendBatch_result, appendBatch_result._Fields>, java.io.Serializable, Cloneable {
  1237. private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("appendBatch_result");
  1238.  
  1239. private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0);
  1240.  
  1241. /**
  1242. *
  1243. * @see Status
  1244. */
  1245. public Status success; // required
  1246.  
  1247. /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  1248. public enum _Fields implements org.apache.thrift.TFieldIdEnum {
  1249. /**
  1250. *
  1251. * @see Status
  1252. */
  1253. SUCCESS((short)0, "success");
  1254.  
  1255. private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
  1256.  
  1257. static {
  1258. for (_Fields field : EnumSet.allOf(_Fields.class)) {
  1259. byName.put(field.getFieldName(), field);
  1260. }
  1261. }
  1262.  
  1263. /**
  1264. * Find the _Fields constant that matches fieldId, or null if its not found.
  1265. */
  1266. public static _Fields findByThriftId(int fieldId) {
  1267. switch(fieldId) {
  1268. case 0: // SUCCESS
  1269. return SUCCESS;
  1270. default:
  1271. return null;
  1272. }
  1273. }
  1274.  
  1275. /**
  1276. * Find the _Fields constant that matches fieldId, throwing an exception
  1277. * if it is not found.
  1278. */
  1279. public static _Fields findByThriftIdOrThrow(int fieldId) {
  1280. _Fields fields = findByThriftId(fieldId);
  1281. if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
  1282. return fields;
  1283. }
  1284.  
  1285. /**
  1286. * Find the _Fields constant that matches name, or null if its not found.
  1287. */
  1288. public static _Fields findByName(String name) {
  1289. return byName.get(name);
  1290. }
  1291.  
  1292. private final short _thriftId;
  1293. private final String _fieldName;
  1294.  
  1295. _Fields(short thriftId, String fieldName) {
  1296. _thriftId = thriftId;
  1297. _fieldName = fieldName;
  1298. }
  1299.  
  1300. public short getThriftFieldId() {
  1301. return _thriftId;
  1302. }
  1303.  
  1304. public String getFieldName() {
  1305. return _fieldName;
  1306. }
  1307. }
  1308.  
  1309. // isset id assignments
  1310.  
  1311. public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  1312. static {
  1313. Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
  1314. tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
  1315. new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, Status.class)));
  1316. metaDataMap = Collections.unmodifiableMap(tmpMap);
  1317. org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(appendBatch_result.class, metaDataMap);
  1318. }
  1319.  
  1320. public appendBatch_result() {
  1321. }
  1322.  
  1323. public appendBatch_result(
  1324. Status success)
  1325. {
  1326. this();
  1327. this.success = success;
  1328. }
  1329.  
  1330. /**
  1331. * Performs a deep copy on <i>other</i>.
  1332. */
  1333. public appendBatch_result(appendBatch_result other) {
  1334. if (other.isSetSuccess()) {
  1335. this.success = other.success;
  1336. }
  1337. }
  1338.  
  1339. public appendBatch_result deepCopy() {
  1340. return new appendBatch_result(this);
  1341. }
  1342.  
  1343. @Override
  1344. public void clear() {
  1345. this.success = null;
  1346. }
  1347.  
  1348. /**
  1349. *
  1350. * @see Status
  1351. */
  1352. public Status getSuccess() {
  1353. return this.success;
  1354. }
  1355.  
  1356. /**
  1357. *
  1358. * @see Status
  1359. */
  1360. public appendBatch_result setSuccess(Status success) {
  1361. this.success = success;
  1362. return this;
  1363. }
  1364.  
  1365. public void unsetSuccess() {
  1366. this.success = null;
  1367. }
  1368.  
  1369. /** Returns true if field success is set (has been assigned a value) and false otherwise */
  1370. public boolean isSetSuccess() {
  1371. return this.success != null;
  1372. }
  1373.  
  1374. public void setSuccessIsSet(boolean value) {
  1375. if (!value) {
  1376. this.success = null;
  1377. }
  1378. }
  1379.  
  1380. public void setFieldValue(_Fields field, Object value) {
  1381. switch (field) {
  1382. case SUCCESS:
  1383. if (value == null) {
  1384. unsetSuccess();
  1385. } else {
  1386. setSuccess((Status)value);
  1387. }
  1388. break;
  1389.  
  1390. }
  1391. }
  1392.  
  1393. public Object getFieldValue(_Fields field) {
  1394. switch (field) {
  1395. case SUCCESS:
  1396. return getSuccess();
  1397.  
  1398. }
  1399. throw new IllegalStateException();
  1400. }
  1401.  
  1402. /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  1403. public boolean isSet(_Fields field) {
  1404. if (field == null) {
  1405. throw new IllegalArgumentException();
  1406. }
  1407.  
  1408. switch (field) {
  1409. case SUCCESS:
  1410. return isSetSuccess();
  1411. }
  1412. throw new IllegalStateException();
  1413. }
  1414.  
  1415. @Override
  1416. public boolean equals(Object that) {
  1417. if (that == null)
  1418. return false;
  1419. if (that instanceof appendBatch_result)
  1420. return this.equals((appendBatch_result)that);
  1421. return false;
  1422. }
  1423.  
  1424. public boolean equals(appendBatch_result that) {
  1425. if (that == null)
  1426. return false;
  1427.  
  1428. boolean this_present_success = true && this.isSetSuccess();
  1429. boolean that_present_success = true && that.isSetSuccess();
  1430. if (this_present_success || that_present_success) {
  1431. if (!(this_present_success && that_present_success))
  1432. return false;
  1433. if (!this.success.equals(that.success))
  1434. return false;
  1435. }
  1436.  
  1437. return true;
  1438. }
  1439.  
  1440. @Override
  1441. public int hashCode() {
  1442. HashCodeBuilder builder = new HashCodeBuilder();
  1443.  
  1444. boolean present_success = true && (isSetSuccess());
  1445. builder.append(present_success);
  1446. if (present_success)
  1447. builder.append(success.getValue());
  1448.  
  1449. return builder.toHashCode();
  1450. }
  1451.  
  1452. public int compareTo(appendBatch_result other) {
  1453. if (!getClass().equals(other.getClass())) {
  1454. return getClass().getName().compareTo(other.getClass().getName());
  1455. }
  1456.  
  1457. int lastComparison = 0;
  1458. appendBatch_result typedOther = (appendBatch_result)other;
  1459.  
  1460. lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess());
  1461. if (lastComparison != 0) {
  1462. return lastComparison;
  1463. }
  1464. if (isSetSuccess()) {
  1465. lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, typedOther.success);
  1466. if (lastComparison != 0) {
  1467. return lastComparison;
  1468. }
  1469. }
  1470. return 0;
  1471. }
  1472.  
  1473. public _Fields fieldForId(int fieldId) {
  1474. return _Fields.findByThriftId(fieldId);
  1475. }
  1476.  
  1477. public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
  1478. org.apache.thrift.protocol.TField field;
  1479. iprot.readStructBegin();
  1480. while (true)
  1481. {
  1482. field = iprot.readFieldBegin();
  1483. if (field.type == org.apache.thrift.protocol.TType.STOP) {
  1484. break;
  1485. }
  1486. switch (field.id) {
  1487. case 0: // SUCCESS
  1488. if (field.type == org.apache.thrift.protocol.TType.I32) {
  1489. this.success = Status.findByValue(iprot.readI32());
  1490. } else {
  1491. org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
  1492. }
  1493. break;
  1494. default:
  1495. org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
  1496. }
  1497. iprot.readFieldEnd();
  1498. }
  1499. iprot.readStructEnd();
  1500.  
  1501. // check for required fields of primitive type, which can't be checked in the validate method
  1502. validate();
  1503. }
  1504.  
  1505. public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
  1506. oprot.writeStructBegin(STRUCT_DESC);
  1507.  
  1508. if (this.isSetSuccess()) {
  1509. oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
  1510. oprot.writeI32(this.success.getValue());
  1511. oprot.writeFieldEnd();
  1512. }
  1513. oprot.writeFieldStop();
  1514. oprot.writeStructEnd();
  1515. }
  1516.  
  1517. @Override
  1518. public String toString() {
  1519. StringBuilder sb = new StringBuilder("appendBatch_result(");
  1520. boolean first = true;
  1521.  
  1522. sb.append("success:");
  1523. if (this.success == null) {
  1524. sb.append("null");
  1525. } else {
  1526. sb.append(this.success);
  1527. }
  1528. first = false;
  1529. sb.append(")");
  1530. return sb.toString();
  1531. }
  1532.  
  1533. public void validate() throws org.apache.thrift.TException {
  1534. // check for required fields
  1535. }
  1536.  
  1537. private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
  1538. try {
  1539. write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
  1540. } catch (org.apache.thrift.TException te) {
  1541. throw new java.io.IOException(te);
  1542. }
  1543. }
  1544.  
  1545. private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
  1546. try {
  1547. read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
  1548. } catch (org.apache.thrift.TException te) {
  1549. throw new java.io.IOException(te);
  1550. }
  1551. }
  1552.  
  1553. }
  1554.  
  1555. }

Thrift-RPC client in Flume的更多相关文章

  1. Thrift 个人实战--Thrift 服务化 Client的改造

    前言: Thrift作为Facebook开源的RPC框架, 通过IDL中间语言, 并借助代码生成引擎生成各种主流语言的rpc框架服务端/客户端代码. 不过Thrift的实现, 简单使用离实际生产环境还 ...

  2. 利用thrift rpc进行C++与Go的通信

    一:什么是rpc rpc通俗来理解就是远程调用函数,相对于本地调用来说,只需要在主调函数中调用被掉函数即可,代码如下: void fun(int i) { cout << "fu ...

  3. Avro-RPC client in Flume

    Avro used in Flume Define the interface of RpcClient public interface RpcClient { public int getBatc ...

  4. thrift RPC 框架的自我搭建

    安装thrift rpc   安装的系统是Centos 7 未成功的方法 :(原因没找到,但是还是要记录下) 安装依赖库 yum install automake libtool flex bison ...

  5. Thrift RPC Golang、C++ Example

    Thrift RPC Example 运行 请直接使用即可,无需拉取任何依赖包. cd $GOPATH/src git clone https://github.com/hunterhug/thrif ...

  6. 又一个半成品库 weblog rpc client

    我基本上属于半成品专业户,去看我的github就知道. 下午又撸了一个weblog rpc client库,而这又一次证明了一个有技术但没有产品能力的程序员是没有卵用的. 因为当做好了库的雏形,但与具 ...

  7. 用NFS挂载root出现:NFS: failed to create MNT RPC client, status=-101(-110)

      2014-02-18 08:06:17 By Ly #Linux 阅读(78) 评论(0) 错误信息如下: Root-NFS: nfsroot=/home/zenki/nfs/rootfs NFS ...

  8. 使用Zeppelin时出现at org.apache.zeppelin.interpreter.thrift.RemoteInterpreterService$Client.recv_getFormType(RemoteInterpreterService.java:288)错误的解决办法(图文详解)

    不多说,直接上干货! 问题详解 org.apache.thrift.TApplicationException: Internal error processing getFormType at or ...

  9. thrift rpc通信

    thrift rpc通信 框架 别人的简历: 负责抓取程序的开发和维护,对抓取内容进行数据提取.整理.1.定向数据抓取程序的维护和开发,了解了Sqlite数据库.Thrift服务和多线程的开发调试.2 ...

随机推荐

  1. java面向对象概念1

    一.java面向对象学习的三条主线: 1.java类及类的成员:属性.方法.构造器:代码块.内部类 2.面向对象的三大特征:封装性.继承性.多态性.(抽象性) 3.其它关键字:this.super.s ...

  2. Go语言fmt包详解

    格式化输出函数 fmt包含有格式化I/O函数,类似于C语言的printf和scanf.格式字符串的规则来源于C,但更简单一些 1.print和println方法 print输出给定的字符串,如果是数值 ...

  3. Codeforces - tag::data structures 大合集 [占坑 25 / 0x3f3f3f3f]

    371D 小盘子不断嵌套与大盘子,最后与地面相连,往里面灌水,溢出部分会往下面流,求每次操作时当前的盘子的容量 其实这道题是期末考前就做好了的.. 链式结构考虑并查集,然后没了(求大佬解释第一个T的点 ...

  4. python进程进阶

    本节目录: 1.进程的其他方法 2.验证进程之间是空间隔离的 3.守护进程 4.互斥锁 5.编写一个伪抢票程序 6.数据共享 7.for循环,join 8.队列 9.用队列完成一个生产者消费者模型 1 ...

  5. springcloud(三)-Eureka

    Eureka是Netflix开源的一款提供服务注册和发现的产品,它提供了完整的Service Registry和Service Discovery实现.也是springcloud体系中最重要最核心的组 ...

  6. js 常见事件

  7. ionic3打包打包安卓apk详细过程以及遇到的问题

    1.jdk和sdk的安装以及环境变量配置参考打包详解 上述连接已经从下载安装jdk以及sdk的环境变量配置到打包的流程以及很详细了.但是在我自己安装打包的过程中遇到了这篇文章中没有遇到的问题,下面图文 ...

  8. java中的各种命令参数

    java中有很多命令参数,这些命令参数有些是控制jvm行为的,有的则是供应用程序使用.我所了解的参数主要有三种,现在说一说这三种类型的参数. (1)命令行参数. 命令行参数就是类似与c语言的命令行参数 ...

  9. [tools]转载汇总

    1. 发送请求工具—Advanced REST Client Advanced REST Client是Chrome浏览器下的一个插件,通过它可以发送http.https.WebSocket请求.

  10. jq访问网络接口实例

    最近需要在app生活频道上,需要添加一些类目,这就需要用到一些公用的开放接口,ajax其实调用并不复杂,但是结合jquery则显得更简洁一些,下面一起来看看jquery调用后台api. 代码如下: & ...