/**
 * Autogenerated by Thrift Compiler (0.9.2)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
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 javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-6-9")
public class MessageService {

  public interface Iface {

    public void online(UserId userId) throws error, org.apache.thrift.TException;

    public void offline(UserId userId) throws error, org.apache.thrift.TException;

    public void keepAlive(UserId userId) throws error, org.apache.thrift.TException;

    public void sendMessage(UserId userId, short cmd, String message) throws error, org.apache.thrift.TException;

    public void sendMessageToUserIdCollection(List<UserId> userIdCollection, short cmd, String message) throws error, org.apache.thrift.TException;

    public List<Boolean> getUserOnlineStatus(List<UserId> userIdCollection) throws error, org.apache.thrift.TException;

    public void sendMessageWithOneOfflineMessage(List<UserId> userIdCollection, short cmd, String message) throws error, org.apache.thrift.TException;

    public void sendMessageToRoom(String nsp, String room, short cmd, String message) throws error, org.apache.thrift.TException;

  }

  public interface AsyncIface {

    public void online(UserId userId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;

    public void offline(UserId userId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;

    public void keepAlive(UserId userId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;

    public void sendMessage(UserId userId, short cmd, String message, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;

    public void sendMessageToUserIdCollection(List<UserId> userIdCollection, short cmd, String message, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;

    public void getUserOnlineStatus(List<UserId> userIdCollection, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;

    public void sendMessageWithOneOfflineMessage(List<UserId> userIdCollection, short cmd, String message, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;

    public void sendMessageToRoom(String nsp, String room, short cmd, String message, 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<Client> {
      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 online(UserId userId) throws error, org.apache.thrift.TException
    {
      send_online(userId);
      recv_online();
    }

    public void send_online(UserId userId) throws org.apache.thrift.TException
    {
      online_args args = new online_args();
      args.setUserId(userId);
      sendBase("online", args);
    }

    public void recv_online() throws error, org.apache.thrift.TException
    {
      online_result result = new online_result();
      receiveBase(result, "online");
      if (result.error != null) {
        throw result.error;
      }
      return;
    }

    public void offline(UserId userId) throws error, org.apache.thrift.TException
    {
      send_offline(userId);
      recv_offline();
    }

    public void send_offline(UserId userId) throws org.apache.thrift.TException
    {
      offline_args args = new offline_args();
      args.setUserId(userId);
      sendBase("offline", args);
    }

    public void recv_offline() throws error, org.apache.thrift.TException
    {
      offline_result result = new offline_result();
      receiveBase(result, "offline");
      if (result.error != null) {
        throw result.error;
      }
      return;
    }

    public void keepAlive(UserId userId) throws error, org.apache.thrift.TException
    {
      send_keepAlive(userId);
      recv_keepAlive();
    }

    public void send_keepAlive(UserId userId) throws org.apache.thrift.TException
    {
      keepAlive_args args = new keepAlive_args();
      args.setUserId(userId);
      sendBase("keepAlive", args);
    }

    public void recv_keepAlive() throws error, org.apache.thrift.TException
    {
      keepAlive_result result = new keepAlive_result();
      receiveBase(result, "keepAlive");
      if (result.error != null) {
        throw result.error;
      }
      return;
    }

    public void sendMessage(UserId userId, short cmd, String message) throws error, org.apache.thrift.TException
    {
      send_sendMessage(userId, cmd, message);
      recv_sendMessage();
    }

    public void send_sendMessage(UserId userId, short cmd, String message) throws org.apache.thrift.TException
    {
      sendMessage_args args = new sendMessage_args();
      args.setUserId(userId);
      args.setCmd(cmd);
      args.setMessage(message);
      sendBase("sendMessage", args);
    }

    public void recv_sendMessage() throws error, org.apache.thrift.TException
    {
      sendMessage_result result = new sendMessage_result();
      receiveBase(result, "sendMessage");
      if (result.error != null) {
        throw result.error;
      }
      return;
    }

    public void sendMessageToUserIdCollection(List<UserId> userIdCollection, short cmd, String message) throws error, org.apache.thrift.TException
    {
      send_sendMessageToUserIdCollection(userIdCollection, cmd, message);
      recv_sendMessageToUserIdCollection();
    }

    public void send_sendMessageToUserIdCollection(List<UserId> userIdCollection, short cmd, String message) throws org.apache.thrift.TException
    {
      sendMessageToUserIdCollection_args args = new sendMessageToUserIdCollection_args();
      args.setUserIdCollection(userIdCollection);
      args.setCmd(cmd);
      args.setMessage(message);
      sendBase("sendMessageToUserIdCollection", args);
    }

    public void recv_sendMessageToUserIdCollection() throws error, org.apache.thrift.TException
    {
      sendMessageToUserIdCollection_result result = new sendMessageToUserIdCollection_result();
      receiveBase(result, "sendMessageToUserIdCollection");
      if (result.error != null) {
        throw result.error;
      }
      return;
    }

    public List<Boolean> getUserOnlineStatus(List<UserId> userIdCollection) throws error, org.apache.thrift.TException
    {
      send_getUserOnlineStatus(userIdCollection);
      return recv_getUserOnlineStatus();
    }

    public void send_getUserOnlineStatus(List<UserId> userIdCollection) throws org.apache.thrift.TException
    {
      getUserOnlineStatus_args args = new getUserOnlineStatus_args();
      args.setUserIdCollection(userIdCollection);
      sendBase("getUserOnlineStatus", args);
    }

    public List<Boolean> recv_getUserOnlineStatus() throws error, org.apache.thrift.TException
    {
      getUserOnlineStatus_result result = new getUserOnlineStatus_result();
      receiveBase(result, "getUserOnlineStatus");
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.error != null) {
        throw result.error;
      }
      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getUserOnlineStatus failed: unknown result");
    }

    public void sendMessageWithOneOfflineMessage(List<UserId> userIdCollection, short cmd, String message) throws error, org.apache.thrift.TException
    {
      send_sendMessageWithOneOfflineMessage(userIdCollection, cmd, message);
      recv_sendMessageWithOneOfflineMessage();
    }

    public void send_sendMessageWithOneOfflineMessage(List<UserId> userIdCollection, short cmd, String message) throws org.apache.thrift.TException
    {
      sendMessageWithOneOfflineMessage_args args = new sendMessageWithOneOfflineMessage_args();
      args.setUserIdCollection(userIdCollection);
      args.setCmd(cmd);
      args.setMessage(message);
      sendBase("sendMessageWithOneOfflineMessage", args);
    }

    public void recv_sendMessageWithOneOfflineMessage() throws error, org.apache.thrift.TException
    {
      sendMessageWithOneOfflineMessage_result result = new sendMessageWithOneOfflineMessage_result();
      receiveBase(result, "sendMessageWithOneOfflineMessage");
      if (result.error != null) {
        throw result.error;
      }
      return;
    }

    public void sendMessageToRoom(String nsp, String room, short cmd, String message) throws error, org.apache.thrift.TException
    {
      send_sendMessageToRoom(nsp, room, cmd, message);
      recv_sendMessageToRoom();
    }

    public void send_sendMessageToRoom(String nsp, String room, short cmd, String message) throws org.apache.thrift.TException
    {
      sendMessageToRoom_args args = new sendMessageToRoom_args();
      args.setNsp(nsp);
      args.setRoom(room);
      args.setCmd(cmd);
      args.setMessage(message);
      sendBase("sendMessageToRoom", args);
    }

    public void recv_sendMessageToRoom() throws error, org.apache.thrift.TException
    {
      sendMessageToRoom_result result = new sendMessageToRoom_result();
      receiveBase(result, "sendMessageToRoom");
      if (result.error != null) {
        throw result.error;
      }
      return;
    }

  }
  public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
    public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
      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 online(UserId userId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
      checkReady();
      online_call method_call = new online_call(userId, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class online_call extends org.apache.thrift.async.TAsyncMethodCall {
      private UserId userId;
      public online_call(UserId userId, 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.userId = userId;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("online", org.apache.thrift.protocol.TMessageType.CALL, 0));
        online_args args = new online_args();
        args.setUserId(userId);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public void getResult() throws error, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        (new Client(prot)).recv_online();
      }
    }

    public void offline(UserId userId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
      checkReady();
      offline_call method_call = new offline_call(userId, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class offline_call extends org.apache.thrift.async.TAsyncMethodCall {
      private UserId userId;
      public offline_call(UserId userId, 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.userId = userId;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("offline", org.apache.thrift.protocol.TMessageType.CALL, 0));
        offline_args args = new offline_args();
        args.setUserId(userId);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public void getResult() throws error, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        (new Client(prot)).recv_offline();
      }
    }

    public void keepAlive(UserId userId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
      checkReady();
      keepAlive_call method_call = new keepAlive_call(userId, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class keepAlive_call extends org.apache.thrift.async.TAsyncMethodCall {
      private UserId userId;
      public keepAlive_call(UserId userId, 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.userId = userId;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("keepAlive", org.apache.thrift.protocol.TMessageType.CALL, 0));
        keepAlive_args args = new keepAlive_args();
        args.setUserId(userId);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public void getResult() throws error, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        (new Client(prot)).recv_keepAlive();
      }
    }

    public void sendMessage(UserId userId, short cmd, String message, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
      checkReady();
      sendMessage_call method_call = new sendMessage_call(userId, cmd, message, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class sendMessage_call extends org.apache.thrift.async.TAsyncMethodCall {
      private UserId userId;
      private short cmd;
      private String message;
      public sendMessage_call(UserId userId, short cmd, String 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.userId = userId;
        this.cmd = cmd;
        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("sendMessage", org.apache.thrift.protocol.TMessageType.CALL, 0));
        sendMessage_args args = new sendMessage_args();
        args.setUserId(userId);
        args.setCmd(cmd);
        args.setMessage(message);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public void getResult() throws error, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        (new Client(prot)).recv_sendMessage();
      }
    }

    public void sendMessageToUserIdCollection(List<UserId> userIdCollection, short cmd, String message, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
      checkReady();
      sendMessageToUserIdCollection_call method_call = new sendMessageToUserIdCollection_call(userIdCollection, cmd, message, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class sendMessageToUserIdCollection_call extends org.apache.thrift.async.TAsyncMethodCall {
      private List<UserId> userIdCollection;
      private short cmd;
      private String message;
      public sendMessageToUserIdCollection_call(List<UserId> userIdCollection, short cmd, String 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.userIdCollection = userIdCollection;
        this.cmd = cmd;
        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("sendMessageToUserIdCollection", org.apache.thrift.protocol.TMessageType.CALL, 0));
        sendMessageToUserIdCollection_args args = new sendMessageToUserIdCollection_args();
        args.setUserIdCollection(userIdCollection);
        args.setCmd(cmd);
        args.setMessage(message);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public void getResult() throws error, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        (new Client(prot)).recv_sendMessageToUserIdCollection();
      }
    }

    public void getUserOnlineStatus(List<UserId> userIdCollection, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
      checkReady();
      getUserOnlineStatus_call method_call = new getUserOnlineStatus_call(userIdCollection, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class getUserOnlineStatus_call extends org.apache.thrift.async.TAsyncMethodCall {
      private List<UserId> userIdCollection;
      public getUserOnlineStatus_call(List<UserId> userIdCollection, 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.userIdCollection = userIdCollection;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getUserOnlineStatus", org.apache.thrift.protocol.TMessageType.CALL, 0));
        getUserOnlineStatus_args args = new getUserOnlineStatus_args();
        args.setUserIdCollection(userIdCollection);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public List<Boolean> getResult() throws error, 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_getUserOnlineStatus();
      }
    }

    public void sendMessageWithOneOfflineMessage(List<UserId> userIdCollection, short cmd, String message, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
      checkReady();
      sendMessageWithOneOfflineMessage_call method_call = new sendMessageWithOneOfflineMessage_call(userIdCollection, cmd, message, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class sendMessageWithOneOfflineMessage_call extends org.apache.thrift.async.TAsyncMethodCall {
      private List<UserId> userIdCollection;
      private short cmd;
      private String message;
      public sendMessageWithOneOfflineMessage_call(List<UserId> userIdCollection, short cmd, String 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.userIdCollection = userIdCollection;
        this.cmd = cmd;
        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("sendMessageWithOneOfflineMessage", org.apache.thrift.protocol.TMessageType.CALL, 0));
        sendMessageWithOneOfflineMessage_args args = new sendMessageWithOneOfflineMessage_args();
        args.setUserIdCollection(userIdCollection);
        args.setCmd(cmd);
        args.setMessage(message);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public void getResult() throws error, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        (new Client(prot)).recv_sendMessageWithOneOfflineMessage();
      }
    }

    public void sendMessageToRoom(String nsp, String room, short cmd, String message, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
      checkReady();
      sendMessageToRoom_call method_call = new sendMessageToRoom_call(nsp, room, cmd, message, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class sendMessageToRoom_call extends org.apache.thrift.async.TAsyncMethodCall {
      private String nsp;
      private String room;
      private short cmd;
      private String message;
      public sendMessageToRoom_call(String nsp, String room, short cmd, String 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.nsp = nsp;
        this.room = room;
        this.cmd = cmd;
        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("sendMessageToRoom", org.apache.thrift.protocol.TMessageType.CALL, 0));
        sendMessageToRoom_args args = new sendMessageToRoom_args();
        args.setNsp(nsp);
        args.setRoom(room);
        args.setCmd(cmd);
        args.setMessage(message);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public void getResult() throws error, org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        (new Client(prot)).recv_sendMessageToRoom();
      }
    }

  }

  public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
    private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
    public Processor(I iface) {
      super(iface, getProcessMap(new HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
    }

    protected Processor(I iface, Map<String,  org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> processMap) {
      super(iface, getProcessMap(processMap));
    }

    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) {
      processMap.put("online", new online());
      processMap.put("offline", new offline());
      processMap.put("keepAlive", new keepAlive());
      processMap.put("sendMessage", new sendMessage());
      processMap.put("sendMessageToUserIdCollection", new sendMessageToUserIdCollection());
      processMap.put("getUserOnlineStatus", new getUserOnlineStatus());
      processMap.put("sendMessageWithOneOfflineMessage", new sendMessageWithOneOfflineMessage());
      processMap.put("sendMessageToRoom", new sendMessageToRoom());
      return processMap;
    }

    public static class online<I extends Iface> extends org.apache.thrift.ProcessFunction<I, online_args> {
      public online() {
        super("online");
      }

      public online_args getEmptyArgsInstance() {
        return new online_args();
      }

      protected boolean isOneway() {
        return false;
      }

      public online_result getResult(I iface, online_args args) throws org.apache.thrift.TException {
        online_result result = new online_result();
        try {
          iface.online(args.userId);
        } catch (error error) {
          result.error = error;
        }
        return result;
      }
    }

    public static class offline<I extends Iface> extends org.apache.thrift.ProcessFunction<I, offline_args> {
      public offline() {
        super("offline");
      }

      public offline_args getEmptyArgsInstance() {
        return new offline_args();
      }

      protected boolean isOneway() {
        return false;
      }

      public offline_result getResult(I iface, offline_args args) throws org.apache.thrift.TException {
        offline_result result = new offline_result();
        try {
          iface.offline(args.userId);
        } catch (error error) {
          result.error = error;
        }
        return result;
      }
    }

    public static class keepAlive<I extends Iface> extends org.apache.thrift.ProcessFunction<I, keepAlive_args> {
      public keepAlive() {
        super("keepAlive");
      }

      public keepAlive_args getEmptyArgsInstance() {
        return new keepAlive_args();
      }

      protected boolean isOneway() {
        return false;
      }

      public keepAlive_result getResult(I iface, keepAlive_args args) throws org.apache.thrift.TException {
        keepAlive_result result = new keepAlive_result();
        try {
          iface.keepAlive(args.userId);
        } catch (error error) {
          result.error = error;
        }
        return result;
      }
    }

    public static class sendMessage<I extends Iface> extends org.apache.thrift.ProcessFunction<I, sendMessage_args> {
      public sendMessage() {
        super("sendMessage");
      }

      public sendMessage_args getEmptyArgsInstance() {
        return new sendMessage_args();
      }

      protected boolean isOneway() {
        return false;
      }

      public sendMessage_result getResult(I iface, sendMessage_args args) throws org.apache.thrift.TException {
        sendMessage_result result = new sendMessage_result();
        try {
          iface.sendMessage(args.userId, args.cmd, args.message);
        } catch (error error) {
          result.error = error;
        }
        return result;
      }
    }

    public static class sendMessageToUserIdCollection<I extends Iface> extends org.apache.thrift.ProcessFunction<I, sendMessageToUserIdCollection_args> {
      public sendMessageToUserIdCollection() {
        super("sendMessageToUserIdCollection");
      }

      public sendMessageToUserIdCollection_args getEmptyArgsInstance() {
        return new sendMessageToUserIdCollection_args();
      }

      protected boolean isOneway() {
        return false;
      }

      public sendMessageToUserIdCollection_result getResult(I iface, sendMessageToUserIdCollection_args args) throws org.apache.thrift.TException {
        sendMessageToUserIdCollection_result result = new sendMessageToUserIdCollection_result();
        try {
          iface.sendMessageToUserIdCollection(args.userIdCollection, args.cmd, args.message);
        } catch (error error) {
          result.error = error;
        }
        return result;
      }
    }

    public static class getUserOnlineStatus<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getUserOnlineStatus_args> {
      public getUserOnlineStatus() {
        super("getUserOnlineStatus");
      }

      public getUserOnlineStatus_args getEmptyArgsInstance() {
        return new getUserOnlineStatus_args();
      }

      protected boolean isOneway() {
        return false;
      }

      public getUserOnlineStatus_result getResult(I iface, getUserOnlineStatus_args args) throws org.apache.thrift.TException {
        getUserOnlineStatus_result result = new getUserOnlineStatus_result();
        try {
          result.success = iface.getUserOnlineStatus(args.userIdCollection);
        } catch (error error) {
          result.error = error;
        }
        return result;
      }
    }

    public static class sendMessageWithOneOfflineMessage<I extends Iface> extends org.apache.thrift.ProcessFunction<I, sendMessageWithOneOfflineMessage_args> {
      public sendMessageWithOneOfflineMessage() {
        super("sendMessageWithOneOfflineMessage");
      }

      public sendMessageWithOneOfflineMessage_args getEmptyArgsInstance() {
        return new sendMessageWithOneOfflineMessage_args();
      }

      protected boolean isOneway() {
        return false;
      }

      public sendMessageWithOneOfflineMessage_result getResult(I iface, sendMessageWithOneOfflineMessage_args args) throws org.apache.thrift.TException {
        sendMessageWithOneOfflineMessage_result result = new sendMessageWithOneOfflineMessage_result();
        try {
          iface.sendMessageWithOneOfflineMessage(args.userIdCollection, args.cmd, args.message);
        } catch (error error) {
          result.error = error;
        }
        return result;
      }
    }

    public static class sendMessageToRoom<I extends Iface> extends org.apache.thrift.ProcessFunction<I, sendMessageToRoom_args> {
      public sendMessageToRoom() {
        super("sendMessageToRoom");
      }

      public sendMessageToRoom_args getEmptyArgsInstance() {
        return new sendMessageToRoom_args();
      }

      protected boolean isOneway() {
        return false;
      }

      public sendMessageToRoom_result getResult(I iface, sendMessageToRoom_args args) throws org.apache.thrift.TException {
        sendMessageToRoom_result result = new sendMessageToRoom_result();
        try {
          iface.sendMessageToRoom(args.nsp, args.room, args.cmd, args.message);
        } catch (error error) {
          result.error = error;
        }
        return result;
      }
    }

  }

  public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
    private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName());
    public AsyncProcessor(I iface) {
      super(iface, getProcessMap(new HashMap<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>()));
    }

    protected AsyncProcessor(I iface, Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase, ?>> processMap) {
      super(iface, getProcessMap(processMap));
    }

    private static <I extends AsyncIface> Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase,?>> getProcessMap(Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase, ?>> processMap) {
      processMap.put("online", new online());
      processMap.put("offline", new offline());
      processMap.put("keepAlive", new keepAlive());
      processMap.put("sendMessage", new sendMessage());
      processMap.put("sendMessageToUserIdCollection", new sendMessageToUserIdCollection());
      processMap.put("getUserOnlineStatus", new getUserOnlineStatus());
      processMap.put("sendMessageWithOneOfflineMessage", new sendMessageWithOneOfflineMessage());
      processMap.put("sendMessageToRoom", new sendMessageToRoom());
      return processMap;
    }

    public static class online<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, online_args, Void> {
      public online() {
        super("online");
      }

      public online_args getEmptyArgsInstance() {
        return new online_args();
      }

      public AsyncMethodCallback<Void> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new AsyncMethodCallback<Void>() { 
          public void onComplete(Void o) {
            online_result result = new online_result();
            try {
              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
              return;
            } catch (Exception e) {
              LOGGER.error("Exception writing to internal frame buffer", e);
            }
            fb.close();
          }
          public void onError(Exception e) {
            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TBase msg;
            online_result result = new online_result();
            if (e instanceof error) {
                        result.error = (error) e;
                        result.setErrorIsSet(true);
                        msg = result;
            }
             else 
            {
              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, online_args args, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws TException {
        iface.online(args.userId,resultHandler);
      }
    }

    public static class offline<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, offline_args, Void> {
      public offline() {
        super("offline");
      }

      public offline_args getEmptyArgsInstance() {
        return new offline_args();
      }

      public AsyncMethodCallback<Void> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new AsyncMethodCallback<Void>() { 
          public void onComplete(Void o) {
            offline_result result = new offline_result();
            try {
              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
              return;
            } catch (Exception e) {
              LOGGER.error("Exception writing to internal frame buffer", e);
            }
            fb.close();
          }
          public void onError(Exception e) {
            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TBase msg;
            offline_result result = new offline_result();
            if (e instanceof error) {
                        result.error = (error) e;
                        result.setErrorIsSet(true);
                        msg = result;
            }
             else 
            {
              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, offline_args args, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws TException {
        iface.offline(args.userId,resultHandler);
      }
    }

    public static class keepAlive<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, keepAlive_args, Void> {
      public keepAlive() {
        super("keepAlive");
      }

      public keepAlive_args getEmptyArgsInstance() {
        return new keepAlive_args();
      }

      public AsyncMethodCallback<Void> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new AsyncMethodCallback<Void>() { 
          public void onComplete(Void o) {
            keepAlive_result result = new keepAlive_result();
            try {
              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
              return;
            } catch (Exception e) {
              LOGGER.error("Exception writing to internal frame buffer", e);
            }
            fb.close();
          }
          public void onError(Exception e) {
            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TBase msg;
            keepAlive_result result = new keepAlive_result();
            if (e instanceof error) {
                        result.error = (error) e;
                        result.setErrorIsSet(true);
                        msg = result;
            }
             else 
            {
              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, keepAlive_args args, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws TException {
        iface.keepAlive(args.userId,resultHandler);
      }
    }

    public static class sendMessage<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, sendMessage_args, Void> {
      public sendMessage() {
        super("sendMessage");
      }

      public sendMessage_args getEmptyArgsInstance() {
        return new sendMessage_args();
      }

      public AsyncMethodCallback<Void> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new AsyncMethodCallback<Void>() { 
          public void onComplete(Void o) {
            sendMessage_result result = new sendMessage_result();
            try {
              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
              return;
            } catch (Exception e) {
              LOGGER.error("Exception writing to internal frame buffer", e);
            }
            fb.close();
          }
          public void onError(Exception e) {
            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TBase msg;
            sendMessage_result result = new sendMessage_result();
            if (e instanceof error) {
                        result.error = (error) e;
                        result.setErrorIsSet(true);
                        msg = result;
            }
             else 
            {
              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, sendMessage_args args, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws TException {
        iface.sendMessage(args.userId, args.cmd, args.message,resultHandler);
      }
    }

    public static class sendMessageToUserIdCollection<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, sendMessageToUserIdCollection_args, Void> {
      public sendMessageToUserIdCollection() {
        super("sendMessageToUserIdCollection");
      }

      public sendMessageToUserIdCollection_args getEmptyArgsInstance() {
        return new sendMessageToUserIdCollection_args();
      }

      public AsyncMethodCallback<Void> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new AsyncMethodCallback<Void>() { 
          public void onComplete(Void o) {
            sendMessageToUserIdCollection_result result = new sendMessageToUserIdCollection_result();
            try {
              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
              return;
            } catch (Exception e) {
              LOGGER.error("Exception writing to internal frame buffer", e);
            }
            fb.close();
          }
          public void onError(Exception e) {
            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TBase msg;
            sendMessageToUserIdCollection_result result = new sendMessageToUserIdCollection_result();
            if (e instanceof error) {
                        result.error = (error) e;
                        result.setErrorIsSet(true);
                        msg = result;
            }
             else 
            {
              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, sendMessageToUserIdCollection_args args, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws TException {
        iface.sendMessageToUserIdCollection(args.userIdCollection, args.cmd, args.message,resultHandler);
      }
    }

    public static class getUserOnlineStatus<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getUserOnlineStatus_args, List<Boolean>> {
      public getUserOnlineStatus() {
        super("getUserOnlineStatus");
      }

      public getUserOnlineStatus_args getEmptyArgsInstance() {
        return new getUserOnlineStatus_args();
      }

      public AsyncMethodCallback<List<Boolean>> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new AsyncMethodCallback<List<Boolean>>() { 
          public void onComplete(List<Boolean> o) {
            getUserOnlineStatus_result result = new getUserOnlineStatus_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;
            getUserOnlineStatus_result result = new getUserOnlineStatus_result();
            if (e instanceof error) {
                        result.error = (error) e;
                        result.setErrorIsSet(true);
                        msg = result;
            }
             else 
            {
              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, getUserOnlineStatus_args args, org.apache.thrift.async.AsyncMethodCallback<List<Boolean>> resultHandler) throws TException {
        iface.getUserOnlineStatus(args.userIdCollection,resultHandler);
      }
    }

    public static class sendMessageWithOneOfflineMessage<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, sendMessageWithOneOfflineMessage_args, Void> {
      public sendMessageWithOneOfflineMessage() {
        super("sendMessageWithOneOfflineMessage");
      }

      public sendMessageWithOneOfflineMessage_args getEmptyArgsInstance() {
        return new sendMessageWithOneOfflineMessage_args();
      }

      public AsyncMethodCallback<Void> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new AsyncMethodCallback<Void>() { 
          public void onComplete(Void o) {
            sendMessageWithOneOfflineMessage_result result = new sendMessageWithOneOfflineMessage_result();
            try {
              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
              return;
            } catch (Exception e) {
              LOGGER.error("Exception writing to internal frame buffer", e);
            }
            fb.close();
          }
          public void onError(Exception e) {
            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TBase msg;
            sendMessageWithOneOfflineMessage_result result = new sendMessageWithOneOfflineMessage_result();
            if (e instanceof error) {
                        result.error = (error) e;
                        result.setErrorIsSet(true);
                        msg = result;
            }
             else 
            {
              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, sendMessageWithOneOfflineMessage_args args, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws TException {
        iface.sendMessageWithOneOfflineMessage(args.userIdCollection, args.cmd, args.message,resultHandler);
      }
    }

    public static class sendMessageToRoom<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, sendMessageToRoom_args, Void> {
      public sendMessageToRoom() {
        super("sendMessageToRoom");
      }

      public sendMessageToRoom_args getEmptyArgsInstance() {
        return new sendMessageToRoom_args();
      }

      public AsyncMethodCallback<Void> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new AsyncMethodCallback<Void>() { 
          public void onComplete(Void o) {
            sendMessageToRoom_result result = new sendMessageToRoom_result();
            try {
              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
              return;
            } catch (Exception e) {
              LOGGER.error("Exception writing to internal frame buffer", e);
            }
            fb.close();
          }
          public void onError(Exception e) {
            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TBase msg;
            sendMessageToRoom_result result = new sendMessageToRoom_result();
            if (e instanceof error) {
                        result.error = (error) e;
                        result.setErrorIsSet(true);
                        msg = result;
            }
             else 
            {
              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, sendMessageToRoom_args args, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws TException {
        iface.sendMessageToRoom(args.nsp, args.room, args.cmd, args.message,resultHandler);
      }
    }

  }

  public static class online_args implements org.apache.thrift.TBase<online_args, online_args._Fields>, java.io.Serializable, Cloneable, Comparable<online_args>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("online_args");

    private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userId", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new online_argsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new online_argsTupleSchemeFactory());
    }

    public UserId userId; // required

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
      USER_ID((short)1, "userId");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      static {
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static _Fields findByThriftId(int fieldId) {
        switch(fieldId) {
          case 1: // USER_ID
            return USER_ID;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, throwing an exception
       * if it is not found.
       */
      public static _Fields findByThriftIdOrThrow(int fieldId) {
        _Fields fields = findByThriftId(fieldId);
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
        return fields;
      }

      /**
       * Find the _Fields constant that matches name, or null if its not found.
       */
      public static _Fields findByName(String name) {
        return byName.get(name);
      }

      private final short _thriftId;
      private final String _fieldName;

      _Fields(short thriftId, String fieldName) {
        _thriftId = thriftId;
        _fieldName = fieldName;
      }

      public short getThriftFieldId() {
        return _thriftId;
      }

      public String getFieldName() {
        return _fieldName;
      }
    }

    // isset id assignments
    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    static {
      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
      tmpMap.put(_Fields.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("userId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, UserId.class)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(online_args.class, metaDataMap);
    }

    public online_args() {
    }

    public online_args(
      UserId userId)
    {
      this();
      this.userId = userId;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public online_args(online_args other) {
      if (other.isSetUserId()) {
        this.userId = new UserId(other.userId);
      }
    }

    public online_args deepCopy() {
      return new online_args(this);
    }

    @Override
    public void clear() {
      this.userId = null;
    }

    public UserId getUserId() {
      return this.userId;
    }

    public online_args setUserId(UserId userId) {
      this.userId = userId;
      return this;
    }

    public void unsetUserId() {
      this.userId = null;
    }

    /** Returns true if field userId is set (has been assigned a value) and false otherwise */
    public boolean isSetUserId() {
      return this.userId != null;
    }

    public void setUserIdIsSet(boolean value) {
      if (!value) {
        this.userId = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case USER_ID:
        if (value == null) {
          unsetUserId();
        } else {
          setUserId((UserId)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case USER_ID:
        return getUserId();

      }
      throw new IllegalStateException();
    }

    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
    public boolean isSet(_Fields field) {
      if (field == null) {
        throw new IllegalArgumentException();
      }

      switch (field) {
      case USER_ID:
        return isSetUserId();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof online_args)
        return this.equals((online_args)that);
      return false;
    }

    public boolean equals(online_args that) {
      if (that == null)
        return false;

      boolean this_present_userId = true && this.isSetUserId();
      boolean that_present_userId = true && that.isSetUserId();
      if (this_present_userId || that_present_userId) {
        if (!(this_present_userId && that_present_userId))
          return false;
        if (!this.userId.equals(that.userId))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean present_userId = true && (isSetUserId());
      list.add(present_userId);
      if (present_userId)
        list.add(userId);

      return list.hashCode();
    }

    @Override
    public int compareTo(online_args other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetUserId()).compareTo(other.isSetUserId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetUserId()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      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("online_args(");
      boolean first = true;

      sb.append("userId:");
      if (this.userId == null) {
        sb.append("null");
      } else {
        sb.append(this.userId);
      }
      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 (userId != null) {
        userId.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 online_argsStandardSchemeFactory implements SchemeFactory {
      public online_argsStandardScheme getScheme() {
        return new online_argsStandardScheme();
      }
    }

    private static class online_argsStandardScheme extends StandardScheme<online_args> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, online_args struct) throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true)
        {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
            break;
          }
          switch (schemeField.id) {
            case 1: // USER_ID
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.userId = new UserId();
                struct.userId.read(iprot);
                struct.setUserIdIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, online_args struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.userId != null) {
          oprot.writeFieldBegin(USER_ID_FIELD_DESC);
          struct.userId.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class online_argsTupleSchemeFactory implements SchemeFactory {
      public online_argsTupleScheme getScheme() {
        return new online_argsTupleScheme();
      }
    }

    private static class online_argsTupleScheme extends TupleScheme<online_args> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, online_args struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetUserId()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetUserId()) {
          struct.userId.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, online_args struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          struct.userId = new UserId();
          struct.userId.read(iprot);
          struct.setUserIdIsSet(true);
        }
      }
    }

  }

  public static class online_result implements org.apache.thrift.TBase<online_result, online_result._Fields>, java.io.Serializable, Cloneable, Comparable<online_result>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("online_result");

    private static final org.apache.thrift.protocol.TField ERROR_FIELD_DESC = new org.apache.thrift.protocol.TField("error", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new online_resultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new online_resultTupleSchemeFactory());
    }

    public error error; // required

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
      ERROR((short)1, "error");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      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: // ERROR
            return ERROR;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches 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.ERROR, new org.apache.thrift.meta_data.FieldMetaData("error", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(online_result.class, metaDataMap);
    }

    public online_result() {
    }

    public online_result(
      error error)
    {
      this();
      this.error = error;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public online_result(online_result other) {
      if (other.isSetError()) {
        this.error = new error(other.error);
      }
    }

    public online_result deepCopy() {
      return new online_result(this);
    }

    @Override
    public void clear() {
      this.error = null;
    }

    public error getError() {
      return this.error;
    }

    public online_result setError(error error) {
      this.error = error;
      return this;
    }

    public void unsetError() {
      this.error = null;
    }

    /** Returns true if field error is set (has been assigned a value) and false otherwise */
    public boolean isSetError() {
      return this.error != null;
    }

    public void setErrorIsSet(boolean value) {
      if (!value) {
        this.error = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case ERROR:
        if (value == null) {
          unsetError();
        } else {
          setError((error)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case ERROR:
        return getError();

      }
      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 ERROR:
        return isSetError();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof online_result)
        return this.equals((online_result)that);
      return false;
    }

    public boolean equals(online_result that) {
      if (that == null)
        return false;

      boolean this_present_error = true && this.isSetError();
      boolean that_present_error = true && that.isSetError();
      if (this_present_error || that_present_error) {
        if (!(this_present_error && that_present_error))
          return false;
        if (!this.error.equals(that.error))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean present_error = true && (isSetError());
      list.add(present_error);
      if (present_error)
        list.add(error);

      return list.hashCode();
    }

    @Override
    public int compareTo(online_result other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetError()).compareTo(other.isSetError());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetError()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.error, other.error);
        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("online_result(");
      boolean first = true;

      sb.append("error:");
      if (this.error == null) {
        sb.append("null");
      } else {
        sb.append(this.error);
      }
      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 online_resultStandardSchemeFactory implements SchemeFactory {
      public online_resultStandardScheme getScheme() {
        return new online_resultStandardScheme();
      }
    }

    private static class online_resultStandardScheme extends StandardScheme<online_result> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, online_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 1: // ERROR
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.error = new error();
                struct.error.read(iprot);
                struct.setErrorIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, online_result struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.error != null) {
          oprot.writeFieldBegin(ERROR_FIELD_DESC);
          struct.error.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class online_resultTupleSchemeFactory implements SchemeFactory {
      public online_resultTupleScheme getScheme() {
        return new online_resultTupleScheme();
      }
    }

    private static class online_resultTupleScheme extends TupleScheme<online_result> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, online_result struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetError()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetError()) {
          struct.error.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, online_result struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          struct.error = new error();
          struct.error.read(iprot);
          struct.setErrorIsSet(true);
        }
      }
    }

  }

  public static class offline_args implements org.apache.thrift.TBase<offline_args, offline_args._Fields>, java.io.Serializable, Cloneable, Comparable<offline_args>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("offline_args");

    private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userId", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new offline_argsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new offline_argsTupleSchemeFactory());
    }

    public UserId userId; // required

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
      USER_ID((short)1, "userId");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      static {
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static _Fields findByThriftId(int fieldId) {
        switch(fieldId) {
          case 1: // USER_ID
            return USER_ID;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, throwing an exception
       * if it is not found.
       */
      public static _Fields findByThriftIdOrThrow(int fieldId) {
        _Fields fields = findByThriftId(fieldId);
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
        return fields;
      }

      /**
       * Find the _Fields constant that matches name, or null if its not found.
       */
      public static _Fields findByName(String name) {
        return byName.get(name);
      }

      private final short _thriftId;
      private final String _fieldName;

      _Fields(short thriftId, String fieldName) {
        _thriftId = thriftId;
        _fieldName = fieldName;
      }

      public short getThriftFieldId() {
        return _thriftId;
      }

      public String getFieldName() {
        return _fieldName;
      }
    }

    // isset id assignments
    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    static {
      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
      tmpMap.put(_Fields.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("userId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, UserId.class)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(offline_args.class, metaDataMap);
    }

    public offline_args() {
    }

    public offline_args(
      UserId userId)
    {
      this();
      this.userId = userId;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public offline_args(offline_args other) {
      if (other.isSetUserId()) {
        this.userId = new UserId(other.userId);
      }
    }

    public offline_args deepCopy() {
      return new offline_args(this);
    }

    @Override
    public void clear() {
      this.userId = null;
    }

    public UserId getUserId() {
      return this.userId;
    }

    public offline_args setUserId(UserId userId) {
      this.userId = userId;
      return this;
    }

    public void unsetUserId() {
      this.userId = null;
    }

    /** Returns true if field userId is set (has been assigned a value) and false otherwise */
    public boolean isSetUserId() {
      return this.userId != null;
    }

    public void setUserIdIsSet(boolean value) {
      if (!value) {
        this.userId = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case USER_ID:
        if (value == null) {
          unsetUserId();
        } else {
          setUserId((UserId)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case USER_ID:
        return getUserId();

      }
      throw new IllegalStateException();
    }

    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
    public boolean isSet(_Fields field) {
      if (field == null) {
        throw new IllegalArgumentException();
      }

      switch (field) {
      case USER_ID:
        return isSetUserId();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof offline_args)
        return this.equals((offline_args)that);
      return false;
    }

    public boolean equals(offline_args that) {
      if (that == null)
        return false;

      boolean this_present_userId = true && this.isSetUserId();
      boolean that_present_userId = true && that.isSetUserId();
      if (this_present_userId || that_present_userId) {
        if (!(this_present_userId && that_present_userId))
          return false;
        if (!this.userId.equals(that.userId))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean present_userId = true && (isSetUserId());
      list.add(present_userId);
      if (present_userId)
        list.add(userId);

      return list.hashCode();
    }

    @Override
    public int compareTo(offline_args other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetUserId()).compareTo(other.isSetUserId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetUserId()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      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("offline_args(");
      boolean first = true;

      sb.append("userId:");
      if (this.userId == null) {
        sb.append("null");
      } else {
        sb.append(this.userId);
      }
      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 (userId != null) {
        userId.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 offline_argsStandardSchemeFactory implements SchemeFactory {
      public offline_argsStandardScheme getScheme() {
        return new offline_argsStandardScheme();
      }
    }

    private static class offline_argsStandardScheme extends StandardScheme<offline_args> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, offline_args struct) throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true)
        {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
            break;
          }
          switch (schemeField.id) {
            case 1: // USER_ID
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.userId = new UserId();
                struct.userId.read(iprot);
                struct.setUserIdIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, offline_args struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.userId != null) {
          oprot.writeFieldBegin(USER_ID_FIELD_DESC);
          struct.userId.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class offline_argsTupleSchemeFactory implements SchemeFactory {
      public offline_argsTupleScheme getScheme() {
        return new offline_argsTupleScheme();
      }
    }

    private static class offline_argsTupleScheme extends TupleScheme<offline_args> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, offline_args struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetUserId()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetUserId()) {
          struct.userId.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, offline_args struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          struct.userId = new UserId();
          struct.userId.read(iprot);
          struct.setUserIdIsSet(true);
        }
      }
    }

  }

  public static class offline_result implements org.apache.thrift.TBase<offline_result, offline_result._Fields>, java.io.Serializable, Cloneable, Comparable<offline_result>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("offline_result");

    private static final org.apache.thrift.protocol.TField ERROR_FIELD_DESC = new org.apache.thrift.protocol.TField("error", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new offline_resultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new offline_resultTupleSchemeFactory());
    }

    public error error; // required

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
      ERROR((short)1, "error");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      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: // ERROR
            return ERROR;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches 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.ERROR, new org.apache.thrift.meta_data.FieldMetaData("error", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(offline_result.class, metaDataMap);
    }

    public offline_result() {
    }

    public offline_result(
      error error)
    {
      this();
      this.error = error;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public offline_result(offline_result other) {
      if (other.isSetError()) {
        this.error = new error(other.error);
      }
    }

    public offline_result deepCopy() {
      return new offline_result(this);
    }

    @Override
    public void clear() {
      this.error = null;
    }

    public error getError() {
      return this.error;
    }

    public offline_result setError(error error) {
      this.error = error;
      return this;
    }

    public void unsetError() {
      this.error = null;
    }

    /** Returns true if field error is set (has been assigned a value) and false otherwise */
    public boolean isSetError() {
      return this.error != null;
    }

    public void setErrorIsSet(boolean value) {
      if (!value) {
        this.error = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case ERROR:
        if (value == null) {
          unsetError();
        } else {
          setError((error)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case ERROR:
        return getError();

      }
      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 ERROR:
        return isSetError();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof offline_result)
        return this.equals((offline_result)that);
      return false;
    }

    public boolean equals(offline_result that) {
      if (that == null)
        return false;

      boolean this_present_error = true && this.isSetError();
      boolean that_present_error = true && that.isSetError();
      if (this_present_error || that_present_error) {
        if (!(this_present_error && that_present_error))
          return false;
        if (!this.error.equals(that.error))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean present_error = true && (isSetError());
      list.add(present_error);
      if (present_error)
        list.add(error);

      return list.hashCode();
    }

    @Override
    public int compareTo(offline_result other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetError()).compareTo(other.isSetError());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetError()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.error, other.error);
        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("offline_result(");
      boolean first = true;

      sb.append("error:");
      if (this.error == null) {
        sb.append("null");
      } else {
        sb.append(this.error);
      }
      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 offline_resultStandardSchemeFactory implements SchemeFactory {
      public offline_resultStandardScheme getScheme() {
        return new offline_resultStandardScheme();
      }
    }

    private static class offline_resultStandardScheme extends StandardScheme<offline_result> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, offline_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 1: // ERROR
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.error = new error();
                struct.error.read(iprot);
                struct.setErrorIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, offline_result struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.error != null) {
          oprot.writeFieldBegin(ERROR_FIELD_DESC);
          struct.error.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class offline_resultTupleSchemeFactory implements SchemeFactory {
      public offline_resultTupleScheme getScheme() {
        return new offline_resultTupleScheme();
      }
    }

    private static class offline_resultTupleScheme extends TupleScheme<offline_result> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, offline_result struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetError()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetError()) {
          struct.error.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, offline_result struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          struct.error = new error();
          struct.error.read(iprot);
          struct.setErrorIsSet(true);
        }
      }
    }

  }

  public static class keepAlive_args implements org.apache.thrift.TBase<keepAlive_args, keepAlive_args._Fields>, java.io.Serializable, Cloneable, Comparable<keepAlive_args>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("keepAlive_args");

    private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userId", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new keepAlive_argsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new keepAlive_argsTupleSchemeFactory());
    }

    public UserId userId; // required

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
      USER_ID((short)1, "userId");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      static {
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static _Fields findByThriftId(int fieldId) {
        switch(fieldId) {
          case 1: // USER_ID
            return USER_ID;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, throwing an exception
       * if it is not found.
       */
      public static _Fields findByThriftIdOrThrow(int fieldId) {
        _Fields fields = findByThriftId(fieldId);
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
        return fields;
      }

      /**
       * Find the _Fields constant that matches name, or null if its not found.
       */
      public static _Fields findByName(String name) {
        return byName.get(name);
      }

      private final short _thriftId;
      private final String _fieldName;

      _Fields(short thriftId, String fieldName) {
        _thriftId = thriftId;
        _fieldName = fieldName;
      }

      public short getThriftFieldId() {
        return _thriftId;
      }

      public String getFieldName() {
        return _fieldName;
      }
    }

    // isset id assignments
    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    static {
      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
      tmpMap.put(_Fields.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("userId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, UserId.class)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(keepAlive_args.class, metaDataMap);
    }

    public keepAlive_args() {
    }

    public keepAlive_args(
      UserId userId)
    {
      this();
      this.userId = userId;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public keepAlive_args(keepAlive_args other) {
      if (other.isSetUserId()) {
        this.userId = new UserId(other.userId);
      }
    }

    public keepAlive_args deepCopy() {
      return new keepAlive_args(this);
    }

    @Override
    public void clear() {
      this.userId = null;
    }

    public UserId getUserId() {
      return this.userId;
    }

    public keepAlive_args setUserId(UserId userId) {
      this.userId = userId;
      return this;
    }

    public void unsetUserId() {
      this.userId = null;
    }

    /** Returns true if field userId is set (has been assigned a value) and false otherwise */
    public boolean isSetUserId() {
      return this.userId != null;
    }

    public void setUserIdIsSet(boolean value) {
      if (!value) {
        this.userId = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case USER_ID:
        if (value == null) {
          unsetUserId();
        } else {
          setUserId((UserId)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case USER_ID:
        return getUserId();

      }
      throw new IllegalStateException();
    }

    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
    public boolean isSet(_Fields field) {
      if (field == null) {
        throw new IllegalArgumentException();
      }

      switch (field) {
      case USER_ID:
        return isSetUserId();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof keepAlive_args)
        return this.equals((keepAlive_args)that);
      return false;
    }

    public boolean equals(keepAlive_args that) {
      if (that == null)
        return false;

      boolean this_present_userId = true && this.isSetUserId();
      boolean that_present_userId = true && that.isSetUserId();
      if (this_present_userId || that_present_userId) {
        if (!(this_present_userId && that_present_userId))
          return false;
        if (!this.userId.equals(that.userId))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean present_userId = true && (isSetUserId());
      list.add(present_userId);
      if (present_userId)
        list.add(userId);

      return list.hashCode();
    }

    @Override
    public int compareTo(keepAlive_args other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetUserId()).compareTo(other.isSetUserId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetUserId()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      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("keepAlive_args(");
      boolean first = true;

      sb.append("userId:");
      if (this.userId == null) {
        sb.append("null");
      } else {
        sb.append(this.userId);
      }
      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 (userId != null) {
        userId.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 keepAlive_argsStandardSchemeFactory implements SchemeFactory {
      public keepAlive_argsStandardScheme getScheme() {
        return new keepAlive_argsStandardScheme();
      }
    }

    private static class keepAlive_argsStandardScheme extends StandardScheme<keepAlive_args> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, keepAlive_args struct) throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true)
        {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
            break;
          }
          switch (schemeField.id) {
            case 1: // USER_ID
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.userId = new UserId();
                struct.userId.read(iprot);
                struct.setUserIdIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, keepAlive_args struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.userId != null) {
          oprot.writeFieldBegin(USER_ID_FIELD_DESC);
          struct.userId.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class keepAlive_argsTupleSchemeFactory implements SchemeFactory {
      public keepAlive_argsTupleScheme getScheme() {
        return new keepAlive_argsTupleScheme();
      }
    }

    private static class keepAlive_argsTupleScheme extends TupleScheme<keepAlive_args> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, keepAlive_args struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetUserId()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetUserId()) {
          struct.userId.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, keepAlive_args struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          struct.userId = new UserId();
          struct.userId.read(iprot);
          struct.setUserIdIsSet(true);
        }
      }
    }

  }

  public static class keepAlive_result implements org.apache.thrift.TBase<keepAlive_result, keepAlive_result._Fields>, java.io.Serializable, Cloneable, Comparable<keepAlive_result>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("keepAlive_result");

    private static final org.apache.thrift.protocol.TField ERROR_FIELD_DESC = new org.apache.thrift.protocol.TField("error", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new keepAlive_resultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new keepAlive_resultTupleSchemeFactory());
    }

    public error error; // required

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
      ERROR((short)1, "error");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      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: // ERROR
            return ERROR;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches 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.ERROR, new org.apache.thrift.meta_data.FieldMetaData("error", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(keepAlive_result.class, metaDataMap);
    }

    public keepAlive_result() {
    }

    public keepAlive_result(
      error error)
    {
      this();
      this.error = error;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public keepAlive_result(keepAlive_result other) {
      if (other.isSetError()) {
        this.error = new error(other.error);
      }
    }

    public keepAlive_result deepCopy() {
      return new keepAlive_result(this);
    }

    @Override
    public void clear() {
      this.error = null;
    }

    public error getError() {
      return this.error;
    }

    public keepAlive_result setError(error error) {
      this.error = error;
      return this;
    }

    public void unsetError() {
      this.error = null;
    }

    /** Returns true if field error is set (has been assigned a value) and false otherwise */
    public boolean isSetError() {
      return this.error != null;
    }

    public void setErrorIsSet(boolean value) {
      if (!value) {
        this.error = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case ERROR:
        if (value == null) {
          unsetError();
        } else {
          setError((error)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case ERROR:
        return getError();

      }
      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 ERROR:
        return isSetError();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof keepAlive_result)
        return this.equals((keepAlive_result)that);
      return false;
    }

    public boolean equals(keepAlive_result that) {
      if (that == null)
        return false;

      boolean this_present_error = true && this.isSetError();
      boolean that_present_error = true && that.isSetError();
      if (this_present_error || that_present_error) {
        if (!(this_present_error && that_present_error))
          return false;
        if (!this.error.equals(that.error))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean present_error = true && (isSetError());
      list.add(present_error);
      if (present_error)
        list.add(error);

      return list.hashCode();
    }

    @Override
    public int compareTo(keepAlive_result other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetError()).compareTo(other.isSetError());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetError()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.error, other.error);
        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("keepAlive_result(");
      boolean first = true;

      sb.append("error:");
      if (this.error == null) {
        sb.append("null");
      } else {
        sb.append(this.error);
      }
      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 keepAlive_resultStandardSchemeFactory implements SchemeFactory {
      public keepAlive_resultStandardScheme getScheme() {
        return new keepAlive_resultStandardScheme();
      }
    }

    private static class keepAlive_resultStandardScheme extends StandardScheme<keepAlive_result> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, keepAlive_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 1: // ERROR
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.error = new error();
                struct.error.read(iprot);
                struct.setErrorIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, keepAlive_result struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.error != null) {
          oprot.writeFieldBegin(ERROR_FIELD_DESC);
          struct.error.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class keepAlive_resultTupleSchemeFactory implements SchemeFactory {
      public keepAlive_resultTupleScheme getScheme() {
        return new keepAlive_resultTupleScheme();
      }
    }

    private static class keepAlive_resultTupleScheme extends TupleScheme<keepAlive_result> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, keepAlive_result struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetError()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetError()) {
          struct.error.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, keepAlive_result struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          struct.error = new error();
          struct.error.read(iprot);
          struct.setErrorIsSet(true);
        }
      }
    }

  }

  public static class sendMessage_args implements org.apache.thrift.TBase<sendMessage_args, sendMessage_args._Fields>, java.io.Serializable, Cloneable, Comparable<sendMessage_args>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("sendMessage_args");

    private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userId", org.apache.thrift.protocol.TType.STRUCT, (short)1);
    private static final org.apache.thrift.protocol.TField CMD_FIELD_DESC = new org.apache.thrift.protocol.TField("cmd", org.apache.thrift.protocol.TType.I16, (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.STRING, (short)3);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new sendMessage_argsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new sendMessage_argsTupleSchemeFactory());
    }

    public UserId userId; // required
    public short cmd; // required
    public String 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 {
      USER_ID((short)1, "userId"),
      CMD((short)2, "cmd"),
      MESSAGE((short)3, "message");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      static {
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static _Fields findByThriftId(int fieldId) {
        switch(fieldId) {
          case 1: // USER_ID
            return USER_ID;
          case 2: // CMD
            return CMD;
          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
    private static final int __CMD_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.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("userId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, UserId.class)));
      tmpMap.put(_Fields.CMD, new org.apache.thrift.meta_data.FieldMetaData("cmd", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16)));
      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)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(sendMessage_args.class, metaDataMap);
    }

    public sendMessage_args() {
    }

    public sendMessage_args(
      UserId userId,
      short cmd,
      String message)
    {
      this();
      this.userId = userId;
      this.cmd = cmd;
      setCmdIsSet(true);
      this.message = message;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public sendMessage_args(sendMessage_args other) {
      __isset_bitfield = other.__isset_bitfield;
      if (other.isSetUserId()) {
        this.userId = new UserId(other.userId);
      }
      this.cmd = other.cmd;
      if (other.isSetMessage()) {
        this.message = other.message;
      }
    }

    public sendMessage_args deepCopy() {
      return new sendMessage_args(this);
    }

    @Override
    public void clear() {
      this.userId = null;
      setCmdIsSet(false);
      this.cmd = 0;
      this.message = null;
    }

    public UserId getUserId() {
      return this.userId;
    }

    public sendMessage_args setUserId(UserId userId) {
      this.userId = userId;
      return this;
    }

    public void unsetUserId() {
      this.userId = null;
    }

    /** Returns true if field userId is set (has been assigned a value) and false otherwise */
    public boolean isSetUserId() {
      return this.userId != null;
    }

    public void setUserIdIsSet(boolean value) {
      if (!value) {
        this.userId = null;
      }
    }

    public short getCmd() {
      return this.cmd;
    }

    public sendMessage_args setCmd(short cmd) {
      this.cmd = cmd;
      setCmdIsSet(true);
      return this;
    }

    public void unsetCmd() {
      __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __CMD_ISSET_ID);
    }

    /** Returns true if field cmd is set (has been assigned a value) and false otherwise */
    public boolean isSetCmd() {
      return EncodingUtils.testBit(__isset_bitfield, __CMD_ISSET_ID);
    }

    public void setCmdIsSet(boolean value) {
      __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __CMD_ISSET_ID, value);
    }

    public String getMessage() {
      return this.message;
    }

    public sendMessage_args 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 void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case USER_ID:
        if (value == null) {
          unsetUserId();
        } else {
          setUserId((UserId)value);
        }
        break;

      case CMD:
        if (value == null) {
          unsetCmd();
        } else {
          setCmd((Short)value);
        }
        break;

      case MESSAGE:
        if (value == null) {
          unsetMessage();
        } else {
          setMessage((String)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case USER_ID:
        return getUserId();

      case CMD:
        return Short.valueOf(getCmd());

      case MESSAGE:
        return getMessage();

      }
      throw new IllegalStateException();
    }

    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
    public boolean isSet(_Fields field) {
      if (field == null) {
        throw new IllegalArgumentException();
      }

      switch (field) {
      case USER_ID:
        return isSetUserId();
      case CMD:
        return isSetCmd();
      case MESSAGE:
        return isSetMessage();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof sendMessage_args)
        return this.equals((sendMessage_args)that);
      return false;
    }

    public boolean equals(sendMessage_args that) {
      if (that == null)
        return false;

      boolean this_present_userId = true && this.isSetUserId();
      boolean that_present_userId = true && that.isSetUserId();
      if (this_present_userId || that_present_userId) {
        if (!(this_present_userId && that_present_userId))
          return false;
        if (!this.userId.equals(that.userId))
          return false;
      }

      boolean this_present_cmd = true;
      boolean that_present_cmd = true;
      if (this_present_cmd || that_present_cmd) {
        if (!(this_present_cmd && that_present_cmd))
          return false;
        if (this.cmd != that.cmd)
          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;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean present_userId = true && (isSetUserId());
      list.add(present_userId);
      if (present_userId)
        list.add(userId);

      boolean present_cmd = true;
      list.add(present_cmd);
      if (present_cmd)
        list.add(cmd);

      boolean present_message = true && (isSetMessage());
      list.add(present_message);
      if (present_message)
        list.add(message);

      return list.hashCode();
    }

    @Override
    public int compareTo(sendMessage_args other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetUserId()).compareTo(other.isSetUserId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetUserId()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetCmd()).compareTo(other.isSetCmd());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetCmd()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cmd, other.cmd);
        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;
        }
      }
      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("sendMessage_args(");
      boolean first = true;

      sb.append("userId:");
      if (this.userId == null) {
        sb.append("null");
      } else {
        sb.append(this.userId);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("cmd:");
      sb.append(this.cmd);
      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 (userId != null) {
        userId.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 sendMessage_argsStandardSchemeFactory implements SchemeFactory {
      public sendMessage_argsStandardScheme getScheme() {
        return new sendMessage_argsStandardScheme();
      }
    }

    private static class sendMessage_argsStandardScheme extends StandardScheme<sendMessage_args> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, sendMessage_args struct) throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true)
        {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
            break;
          }
          switch (schemeField.id) {
            case 1: // USER_ID
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.userId = new UserId();
                struct.userId.read(iprot);
                struct.setUserIdIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 2: // CMD
              if (schemeField.type == org.apache.thrift.protocol.TType.I16) {
                struct.cmd = iprot.readI16();
                struct.setCmdIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 3: // 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;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, sendMessage_args struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.userId != null) {
          oprot.writeFieldBegin(USER_ID_FIELD_DESC);
          struct.userId.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldBegin(CMD_FIELD_DESC);
        oprot.writeI16(struct.cmd);
        oprot.writeFieldEnd();
        if (struct.message != null) {
          oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
          oprot.writeString(struct.message);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class sendMessage_argsTupleSchemeFactory implements SchemeFactory {
      public sendMessage_argsTupleScheme getScheme() {
        return new sendMessage_argsTupleScheme();
      }
    }

    private static class sendMessage_argsTupleScheme extends TupleScheme<sendMessage_args> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, sendMessage_args struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetUserId()) {
          optionals.set(0);
        }
        if (struct.isSetCmd()) {
          optionals.set(1);
        }
        if (struct.isSetMessage()) {
          optionals.set(2);
        }
        oprot.writeBitSet(optionals, 3);
        if (struct.isSetUserId()) {
          struct.userId.write(oprot);
        }
        if (struct.isSetCmd()) {
          oprot.writeI16(struct.cmd);
        }
        if (struct.isSetMessage()) {
          oprot.writeString(struct.message);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, sendMessage_args struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(3);
        if (incoming.get(0)) {
          struct.userId = new UserId();
          struct.userId.read(iprot);
          struct.setUserIdIsSet(true);
        }
        if (incoming.get(1)) {
          struct.cmd = iprot.readI16();
          struct.setCmdIsSet(true);
        }
        if (incoming.get(2)) {
          struct.message = iprot.readString();
          struct.setMessageIsSet(true);
        }
      }
    }

  }

  public static class sendMessage_result implements org.apache.thrift.TBase<sendMessage_result, sendMessage_result._Fields>, java.io.Serializable, Cloneable, Comparable<sendMessage_result>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("sendMessage_result");

    private static final org.apache.thrift.protocol.TField ERROR_FIELD_DESC = new org.apache.thrift.protocol.TField("error", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new sendMessage_resultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new sendMessage_resultTupleSchemeFactory());
    }

    public error error; // required

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
      ERROR((short)1, "error");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      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: // ERROR
            return ERROR;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches 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.ERROR, new org.apache.thrift.meta_data.FieldMetaData("error", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(sendMessage_result.class, metaDataMap);
    }

    public sendMessage_result() {
    }

    public sendMessage_result(
      error error)
    {
      this();
      this.error = error;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public sendMessage_result(sendMessage_result other) {
      if (other.isSetError()) {
        this.error = new error(other.error);
      }
    }

    public sendMessage_result deepCopy() {
      return new sendMessage_result(this);
    }

    @Override
    public void clear() {
      this.error = null;
    }

    public error getError() {
      return this.error;
    }

    public sendMessage_result setError(error error) {
      this.error = error;
      return this;
    }

    public void unsetError() {
      this.error = null;
    }

    /** Returns true if field error is set (has been assigned a value) and false otherwise */
    public boolean isSetError() {
      return this.error != null;
    }

    public void setErrorIsSet(boolean value) {
      if (!value) {
        this.error = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case ERROR:
        if (value == null) {
          unsetError();
        } else {
          setError((error)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case ERROR:
        return getError();

      }
      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 ERROR:
        return isSetError();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof sendMessage_result)
        return this.equals((sendMessage_result)that);
      return false;
    }

    public boolean equals(sendMessage_result that) {
      if (that == null)
        return false;

      boolean this_present_error = true && this.isSetError();
      boolean that_present_error = true && that.isSetError();
      if (this_present_error || that_present_error) {
        if (!(this_present_error && that_present_error))
          return false;
        if (!this.error.equals(that.error))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean present_error = true && (isSetError());
      list.add(present_error);
      if (present_error)
        list.add(error);

      return list.hashCode();
    }

    @Override
    public int compareTo(sendMessage_result other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetError()).compareTo(other.isSetError());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetError()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.error, other.error);
        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("sendMessage_result(");
      boolean first = true;

      sb.append("error:");
      if (this.error == null) {
        sb.append("null");
      } else {
        sb.append(this.error);
      }
      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 sendMessage_resultStandardSchemeFactory implements SchemeFactory {
      public sendMessage_resultStandardScheme getScheme() {
        return new sendMessage_resultStandardScheme();
      }
    }

    private static class sendMessage_resultStandardScheme extends StandardScheme<sendMessage_result> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, sendMessage_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 1: // ERROR
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.error = new error();
                struct.error.read(iprot);
                struct.setErrorIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, sendMessage_result struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.error != null) {
          oprot.writeFieldBegin(ERROR_FIELD_DESC);
          struct.error.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class sendMessage_resultTupleSchemeFactory implements SchemeFactory {
      public sendMessage_resultTupleScheme getScheme() {
        return new sendMessage_resultTupleScheme();
      }
    }

    private static class sendMessage_resultTupleScheme extends TupleScheme<sendMessage_result> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, sendMessage_result struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetError()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetError()) {
          struct.error.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, sendMessage_result struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          struct.error = new error();
          struct.error.read(iprot);
          struct.setErrorIsSet(true);
        }
      }
    }

  }

  public static class sendMessageToUserIdCollection_args implements org.apache.thrift.TBase<sendMessageToUserIdCollection_args, sendMessageToUserIdCollection_args._Fields>, java.io.Serializable, Cloneable, Comparable<sendMessageToUserIdCollection_args>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("sendMessageToUserIdCollection_args");

    private static final org.apache.thrift.protocol.TField USER_ID_COLLECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("userIdCollection", org.apache.thrift.protocol.TType.LIST, (short)1);
    private static final org.apache.thrift.protocol.TField CMD_FIELD_DESC = new org.apache.thrift.protocol.TField("cmd", org.apache.thrift.protocol.TType.I16, (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.STRING, (short)3);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new sendMessageToUserIdCollection_argsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new sendMessageToUserIdCollection_argsTupleSchemeFactory());
    }

    public List<UserId> userIdCollection; // required
    public short cmd; // required
    public String 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 {
      USER_ID_COLLECTION((short)1, "userIdCollection"),
      CMD((short)2, "cmd"),
      MESSAGE((short)3, "message");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      static {
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static _Fields findByThriftId(int fieldId) {
        switch(fieldId) {
          case 1: // USER_ID_COLLECTION
            return USER_ID_COLLECTION;
          case 2: // CMD
            return CMD;
          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
    private static final int __CMD_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.USER_ID_COLLECTION, new org.apache.thrift.meta_data.FieldMetaData("userIdCollection", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.LIST          , "UserIdCollection")));
      tmpMap.put(_Fields.CMD, new org.apache.thrift.meta_data.FieldMetaData("cmd", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16)));
      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)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(sendMessageToUserIdCollection_args.class, metaDataMap);
    }

    public sendMessageToUserIdCollection_args() {
    }

    public sendMessageToUserIdCollection_args(
      List<UserId> userIdCollection,
      short cmd,
      String message)
    {
      this();
      this.userIdCollection = userIdCollection;
      this.cmd = cmd;
      setCmdIsSet(true);
      this.message = message;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public sendMessageToUserIdCollection_args(sendMessageToUserIdCollection_args other) {
      __isset_bitfield = other.__isset_bitfield;
      if (other.isSetUserIdCollection()) {
        this.userIdCollection = other.userIdCollection;
      }
      this.cmd = other.cmd;
      if (other.isSetMessage()) {
        this.message = other.message;
      }
    }

    public sendMessageToUserIdCollection_args deepCopy() {
      return new sendMessageToUserIdCollection_args(this);
    }

    @Override
    public void clear() {
      this.userIdCollection = null;
      setCmdIsSet(false);
      this.cmd = 0;
      this.message = null;
    }

    public int getUserIdCollectionSize() {
      return (this.userIdCollection == null) ? 0 : this.userIdCollection.size();
    }

    public java.util.Iterator<UserId> getUserIdCollectionIterator() {
      return (this.userIdCollection == null) ? null : this.userIdCollection.iterator();
    }

    public void addToUserIdCollection(UserId elem) {
      if (this.userIdCollection == null) {
        this.userIdCollection = new ArrayList<UserId>();
      }
      this.userIdCollection.add(elem);
    }

    public List<UserId> getUserIdCollection() {
      return this.userIdCollection;
    }

    public sendMessageToUserIdCollection_args setUserIdCollection(List<UserId> userIdCollection) {
      this.userIdCollection = userIdCollection;
      return this;
    }

    public void unsetUserIdCollection() {
      this.userIdCollection = null;
    }

    /** Returns true if field userIdCollection is set (has been assigned a value) and false otherwise */
    public boolean isSetUserIdCollection() {
      return this.userIdCollection != null;
    }

    public void setUserIdCollectionIsSet(boolean value) {
      if (!value) {
        this.userIdCollection = null;
      }
    }

    public short getCmd() {
      return this.cmd;
    }

    public sendMessageToUserIdCollection_args setCmd(short cmd) {
      this.cmd = cmd;
      setCmdIsSet(true);
      return this;
    }

    public void unsetCmd() {
      __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __CMD_ISSET_ID);
    }

    /** Returns true if field cmd is set (has been assigned a value) and false otherwise */
    public boolean isSetCmd() {
      return EncodingUtils.testBit(__isset_bitfield, __CMD_ISSET_ID);
    }

    public void setCmdIsSet(boolean value) {
      __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __CMD_ISSET_ID, value);
    }

    public String getMessage() {
      return this.message;
    }

    public sendMessageToUserIdCollection_args 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 void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case USER_ID_COLLECTION:
        if (value == null) {
          unsetUserIdCollection();
        } else {
          setUserIdCollection((List<UserId>)value);
        }
        break;

      case CMD:
        if (value == null) {
          unsetCmd();
        } else {
          setCmd((Short)value);
        }
        break;

      case MESSAGE:
        if (value == null) {
          unsetMessage();
        } else {
          setMessage((String)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case USER_ID_COLLECTION:
        return getUserIdCollection();

      case CMD:
        return Short.valueOf(getCmd());

      case MESSAGE:
        return getMessage();

      }
      throw new IllegalStateException();
    }

    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
    public boolean isSet(_Fields field) {
      if (field == null) {
        throw new IllegalArgumentException();
      }

      switch (field) {
      case USER_ID_COLLECTION:
        return isSetUserIdCollection();
      case CMD:
        return isSetCmd();
      case MESSAGE:
        return isSetMessage();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof sendMessageToUserIdCollection_args)
        return this.equals((sendMessageToUserIdCollection_args)that);
      return false;
    }

    public boolean equals(sendMessageToUserIdCollection_args that) {
      if (that == null)
        return false;

      boolean this_present_userIdCollection = true && this.isSetUserIdCollection();
      boolean that_present_userIdCollection = true && that.isSetUserIdCollection();
      if (this_present_userIdCollection || that_present_userIdCollection) {
        if (!(this_present_userIdCollection && that_present_userIdCollection))
          return false;
        if (!this.userIdCollection.equals(that.userIdCollection))
          return false;
      }

      boolean this_present_cmd = true;
      boolean that_present_cmd = true;
      if (this_present_cmd || that_present_cmd) {
        if (!(this_present_cmd && that_present_cmd))
          return false;
        if (this.cmd != that.cmd)
          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;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean present_userIdCollection = true && (isSetUserIdCollection());
      list.add(present_userIdCollection);
      if (present_userIdCollection)
        list.add(userIdCollection);

      boolean present_cmd = true;
      list.add(present_cmd);
      if (present_cmd)
        list.add(cmd);

      boolean present_message = true && (isSetMessage());
      list.add(present_message);
      if (present_message)
        list.add(message);

      return list.hashCode();
    }

    @Override
    public int compareTo(sendMessageToUserIdCollection_args other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetUserIdCollection()).compareTo(other.isSetUserIdCollection());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetUserIdCollection()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userIdCollection, other.userIdCollection);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetCmd()).compareTo(other.isSetCmd());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetCmd()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cmd, other.cmd);
        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;
        }
      }
      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("sendMessageToUserIdCollection_args(");
      boolean first = true;

      sb.append("userIdCollection:");
      if (this.userIdCollection == null) {
        sb.append("null");
      } else {
        sb.append(this.userIdCollection);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("cmd:");
      sb.append(this.cmd);
      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
    }

    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
      try {
        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(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 sendMessageToUserIdCollection_argsStandardSchemeFactory implements SchemeFactory {
      public sendMessageToUserIdCollection_argsStandardScheme getScheme() {
        return new sendMessageToUserIdCollection_argsStandardScheme();
      }
    }

    private static class sendMessageToUserIdCollection_argsStandardScheme extends StandardScheme<sendMessageToUserIdCollection_args> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, sendMessageToUserIdCollection_args struct) throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true)
        {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
            break;
          }
          switch (schemeField.id) {
            case 1: // USER_ID_COLLECTION
              if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
                {
                  org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
                  struct.userIdCollection = new ArrayList<UserId>(_list0.size);
                  UserId _elem1;
                  for (int _i2 = 0; _i2 < _list0.size; ++_i2)
                  {
                    _elem1 = new UserId();
                    _elem1.read(iprot);
                    struct.userIdCollection.add(_elem1);
                  }
                  iprot.readListEnd();
                }
                struct.setUserIdCollectionIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 2: // CMD
              if (schemeField.type == org.apache.thrift.protocol.TType.I16) {
                struct.cmd = iprot.readI16();
                struct.setCmdIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 3: // 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;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, sendMessageToUserIdCollection_args struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.userIdCollection != null) {
          oprot.writeFieldBegin(USER_ID_COLLECTION_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.userIdCollection.size()));
            for (UserId _iter3 : struct.userIdCollection)
            {
              _iter3.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
        oprot.writeFieldBegin(CMD_FIELD_DESC);
        oprot.writeI16(struct.cmd);
        oprot.writeFieldEnd();
        if (struct.message != null) {
          oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
          oprot.writeString(struct.message);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class sendMessageToUserIdCollection_argsTupleSchemeFactory implements SchemeFactory {
      public sendMessageToUserIdCollection_argsTupleScheme getScheme() {
        return new sendMessageToUserIdCollection_argsTupleScheme();
      }
    }

    private static class sendMessageToUserIdCollection_argsTupleScheme extends TupleScheme<sendMessageToUserIdCollection_args> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, sendMessageToUserIdCollection_args struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetUserIdCollection()) {
          optionals.set(0);
        }
        if (struct.isSetCmd()) {
          optionals.set(1);
        }
        if (struct.isSetMessage()) {
          optionals.set(2);
        }
        oprot.writeBitSet(optionals, 3);
        if (struct.isSetUserIdCollection()) {
          {
            oprot.writeI32(struct.userIdCollection.size());
            for (UserId _iter4 : struct.userIdCollection)
            {
              _iter4.write(oprot);
            }
          }
        }
        if (struct.isSetCmd()) {
          oprot.writeI16(struct.cmd);
        }
        if (struct.isSetMessage()) {
          oprot.writeString(struct.message);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, sendMessageToUserIdCollection_args struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(3);
        if (incoming.get(0)) {
          {
            org.apache.thrift.protocol.TList _list5 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
            struct.userIdCollection = new ArrayList<UserId>(_list5.size);
            UserId _elem6;
            for (int _i7 = 0; _i7 < _list5.size; ++_i7)
            {
              _elem6 = new UserId();
              _elem6.read(iprot);
              struct.userIdCollection.add(_elem6);
            }
          }
          struct.setUserIdCollectionIsSet(true);
        }
        if (incoming.get(1)) {
          struct.cmd = iprot.readI16();
          struct.setCmdIsSet(true);
        }
        if (incoming.get(2)) {
          struct.message = iprot.readString();
          struct.setMessageIsSet(true);
        }
      }
    }

  }

  public static class sendMessageToUserIdCollection_result implements org.apache.thrift.TBase<sendMessageToUserIdCollection_result, sendMessageToUserIdCollection_result._Fields>, java.io.Serializable, Cloneable, Comparable<sendMessageToUserIdCollection_result>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("sendMessageToUserIdCollection_result");

    private static final org.apache.thrift.protocol.TField ERROR_FIELD_DESC = new org.apache.thrift.protocol.TField("error", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new sendMessageToUserIdCollection_resultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new sendMessageToUserIdCollection_resultTupleSchemeFactory());
    }

    public error error; // required

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
      ERROR((short)1, "error");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      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: // ERROR
            return ERROR;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches 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.ERROR, new org.apache.thrift.meta_data.FieldMetaData("error", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(sendMessageToUserIdCollection_result.class, metaDataMap);
    }

    public sendMessageToUserIdCollection_result() {
    }

    public sendMessageToUserIdCollection_result(
      error error)
    {
      this();
      this.error = error;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public sendMessageToUserIdCollection_result(sendMessageToUserIdCollection_result other) {
      if (other.isSetError()) {
        this.error = new error(other.error);
      }
    }

    public sendMessageToUserIdCollection_result deepCopy() {
      return new sendMessageToUserIdCollection_result(this);
    }

    @Override
    public void clear() {
      this.error = null;
    }

    public error getError() {
      return this.error;
    }

    public sendMessageToUserIdCollection_result setError(error error) {
      this.error = error;
      return this;
    }

    public void unsetError() {
      this.error = null;
    }

    /** Returns true if field error is set (has been assigned a value) and false otherwise */
    public boolean isSetError() {
      return this.error != null;
    }

    public void setErrorIsSet(boolean value) {
      if (!value) {
        this.error = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case ERROR:
        if (value == null) {
          unsetError();
        } else {
          setError((error)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case ERROR:
        return getError();

      }
      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 ERROR:
        return isSetError();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof sendMessageToUserIdCollection_result)
        return this.equals((sendMessageToUserIdCollection_result)that);
      return false;
    }

    public boolean equals(sendMessageToUserIdCollection_result that) {
      if (that == null)
        return false;

      boolean this_present_error = true && this.isSetError();
      boolean that_present_error = true && that.isSetError();
      if (this_present_error || that_present_error) {
        if (!(this_present_error && that_present_error))
          return false;
        if (!this.error.equals(that.error))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean present_error = true && (isSetError());
      list.add(present_error);
      if (present_error)
        list.add(error);

      return list.hashCode();
    }

    @Override
    public int compareTo(sendMessageToUserIdCollection_result other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetError()).compareTo(other.isSetError());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetError()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.error, other.error);
        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("sendMessageToUserIdCollection_result(");
      boolean first = true;

      sb.append("error:");
      if (this.error == null) {
        sb.append("null");
      } else {
        sb.append(this.error);
      }
      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 sendMessageToUserIdCollection_resultStandardSchemeFactory implements SchemeFactory {
      public sendMessageToUserIdCollection_resultStandardScheme getScheme() {
        return new sendMessageToUserIdCollection_resultStandardScheme();
      }
    }

    private static class sendMessageToUserIdCollection_resultStandardScheme extends StandardScheme<sendMessageToUserIdCollection_result> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, sendMessageToUserIdCollection_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 1: // ERROR
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.error = new error();
                struct.error.read(iprot);
                struct.setErrorIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, sendMessageToUserIdCollection_result struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.error != null) {
          oprot.writeFieldBegin(ERROR_FIELD_DESC);
          struct.error.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class sendMessageToUserIdCollection_resultTupleSchemeFactory implements SchemeFactory {
      public sendMessageToUserIdCollection_resultTupleScheme getScheme() {
        return new sendMessageToUserIdCollection_resultTupleScheme();
      }
    }

    private static class sendMessageToUserIdCollection_resultTupleScheme extends TupleScheme<sendMessageToUserIdCollection_result> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, sendMessageToUserIdCollection_result struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetError()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetError()) {
          struct.error.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, sendMessageToUserIdCollection_result struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          struct.error = new error();
          struct.error.read(iprot);
          struct.setErrorIsSet(true);
        }
      }
    }

  }

  public static class getUserOnlineStatus_args implements org.apache.thrift.TBase<getUserOnlineStatus_args, getUserOnlineStatus_args._Fields>, java.io.Serializable, Cloneable, Comparable<getUserOnlineStatus_args>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getUserOnlineStatus_args");

    private static final org.apache.thrift.protocol.TField USER_ID_COLLECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("userIdCollection", org.apache.thrift.protocol.TType.LIST, (short)1);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new getUserOnlineStatus_argsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new getUserOnlineStatus_argsTupleSchemeFactory());
    }

    public List<UserId> userIdCollection; // required

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
      USER_ID_COLLECTION((short)1, "userIdCollection");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      static {
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static _Fields findByThriftId(int fieldId) {
        switch(fieldId) {
          case 1: // USER_ID_COLLECTION
            return USER_ID_COLLECTION;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, throwing an exception
       * if it is not found.
       */
      public static _Fields findByThriftIdOrThrow(int fieldId) {
        _Fields fields = findByThriftId(fieldId);
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
        return fields;
      }

      /**
       * Find the _Fields constant that matches name, or null if its not found.
       */
      public static _Fields findByName(String name) {
        return byName.get(name);
      }

      private final short _thriftId;
      private final String _fieldName;

      _Fields(short thriftId, String fieldName) {
        _thriftId = thriftId;
        _fieldName = fieldName;
      }

      public short getThriftFieldId() {
        return _thriftId;
      }

      public String getFieldName() {
        return _fieldName;
      }
    }

    // isset id assignments
    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    static {
      Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
      tmpMap.put(_Fields.USER_ID_COLLECTION, new org.apache.thrift.meta_data.FieldMetaData("userIdCollection", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.LIST          , "UserIdCollection")));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getUserOnlineStatus_args.class, metaDataMap);
    }

    public getUserOnlineStatus_args() {
    }

    public getUserOnlineStatus_args(
      List<UserId> userIdCollection)
    {
      this();
      this.userIdCollection = userIdCollection;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getUserOnlineStatus_args(getUserOnlineStatus_args other) {
      if (other.isSetUserIdCollection()) {
        this.userIdCollection = other.userIdCollection;
      }
    }

    public getUserOnlineStatus_args deepCopy() {
      return new getUserOnlineStatus_args(this);
    }

    @Override
    public void clear() {
      this.userIdCollection = null;
    }

    public int getUserIdCollectionSize() {
      return (this.userIdCollection == null) ? 0 : this.userIdCollection.size();
    }

    public java.util.Iterator<UserId> getUserIdCollectionIterator() {
      return (this.userIdCollection == null) ? null : this.userIdCollection.iterator();
    }

    public void addToUserIdCollection(UserId elem) {
      if (this.userIdCollection == null) {
        this.userIdCollection = new ArrayList<UserId>();
      }
      this.userIdCollection.add(elem);
    }

    public List<UserId> getUserIdCollection() {
      return this.userIdCollection;
    }

    public getUserOnlineStatus_args setUserIdCollection(List<UserId> userIdCollection) {
      this.userIdCollection = userIdCollection;
      return this;
    }

    public void unsetUserIdCollection() {
      this.userIdCollection = null;
    }

    /** Returns true if field userIdCollection is set (has been assigned a value) and false otherwise */
    public boolean isSetUserIdCollection() {
      return this.userIdCollection != null;
    }

    public void setUserIdCollectionIsSet(boolean value) {
      if (!value) {
        this.userIdCollection = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case USER_ID_COLLECTION:
        if (value == null) {
          unsetUserIdCollection();
        } else {
          setUserIdCollection((List<UserId>)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case USER_ID_COLLECTION:
        return getUserIdCollection();

      }
      throw new IllegalStateException();
    }

    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
    public boolean isSet(_Fields field) {
      if (field == null) {
        throw new IllegalArgumentException();
      }

      switch (field) {
      case USER_ID_COLLECTION:
        return isSetUserIdCollection();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof getUserOnlineStatus_args)
        return this.equals((getUserOnlineStatus_args)that);
      return false;
    }

    public boolean equals(getUserOnlineStatus_args that) {
      if (that == null)
        return false;

      boolean this_present_userIdCollection = true && this.isSetUserIdCollection();
      boolean that_present_userIdCollection = true && that.isSetUserIdCollection();
      if (this_present_userIdCollection || that_present_userIdCollection) {
        if (!(this_present_userIdCollection && that_present_userIdCollection))
          return false;
        if (!this.userIdCollection.equals(that.userIdCollection))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean present_userIdCollection = true && (isSetUserIdCollection());
      list.add(present_userIdCollection);
      if (present_userIdCollection)
        list.add(userIdCollection);

      return list.hashCode();
    }

    @Override
    public int compareTo(getUserOnlineStatus_args other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetUserIdCollection()).compareTo(other.isSetUserIdCollection());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetUserIdCollection()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userIdCollection, other.userIdCollection);
        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("getUserOnlineStatus_args(");
      boolean first = true;

      sb.append("userIdCollection:");
      if (this.userIdCollection == null) {
        sb.append("null");
      } else {
        sb.append(this.userIdCollection);
      }
      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 getUserOnlineStatus_argsStandardSchemeFactory implements SchemeFactory {
      public getUserOnlineStatus_argsStandardScheme getScheme() {
        return new getUserOnlineStatus_argsStandardScheme();
      }
    }

    private static class getUserOnlineStatus_argsStandardScheme extends StandardScheme<getUserOnlineStatus_args> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, getUserOnlineStatus_args struct) throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true)
        {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
            break;
          }
          switch (schemeField.id) {
            case 1: // USER_ID_COLLECTION
              if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
                {
                  org.apache.thrift.protocol.TList _list8 = iprot.readListBegin();
                  struct.userIdCollection = new ArrayList<UserId>(_list8.size);
                  UserId _elem9;
                  for (int _i10 = 0; _i10 < _list8.size; ++_i10)
                  {
                    _elem9 = new UserId();
                    _elem9.read(iprot);
                    struct.userIdCollection.add(_elem9);
                  }
                  iprot.readListEnd();
                }
                struct.setUserIdCollectionIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, getUserOnlineStatus_args struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.userIdCollection != null) {
          oprot.writeFieldBegin(USER_ID_COLLECTION_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.userIdCollection.size()));
            for (UserId _iter11 : struct.userIdCollection)
            {
              _iter11.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class getUserOnlineStatus_argsTupleSchemeFactory implements SchemeFactory {
      public getUserOnlineStatus_argsTupleScheme getScheme() {
        return new getUserOnlineStatus_argsTupleScheme();
      }
    }

    private static class getUserOnlineStatus_argsTupleScheme extends TupleScheme<getUserOnlineStatus_args> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, getUserOnlineStatus_args struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetUserIdCollection()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetUserIdCollection()) {
          {
            oprot.writeI32(struct.userIdCollection.size());
            for (UserId _iter12 : struct.userIdCollection)
            {
              _iter12.write(oprot);
            }
          }
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, getUserOnlineStatus_args struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          {
            org.apache.thrift.protocol.TList _list13 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
            struct.userIdCollection = new ArrayList<UserId>(_list13.size);
            UserId _elem14;
            for (int _i15 = 0; _i15 < _list13.size; ++_i15)
            {
              _elem14 = new UserId();
              _elem14.read(iprot);
              struct.userIdCollection.add(_elem14);
            }
          }
          struct.setUserIdCollectionIsSet(true);
        }
      }
    }

  }

  public static class getUserOnlineStatus_result implements org.apache.thrift.TBase<getUserOnlineStatus_result, getUserOnlineStatus_result._Fields>, java.io.Serializable, Cloneable, Comparable<getUserOnlineStatus_result>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getUserOnlineStatus_result");

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.LIST, (short)0);
    private static final org.apache.thrift.protocol.TField ERROR_FIELD_DESC = new org.apache.thrift.protocol.TField("error", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new getUserOnlineStatus_resultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new getUserOnlineStatus_resultTupleSchemeFactory());
    }

    public List<Boolean> success; // required
    public error error; // required

    /** 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"),
      ERROR((short)1, "error");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      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;
          case 1: // ERROR
            return ERROR;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches 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.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
              new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))));
      tmpMap.put(_Fields.ERROR, new org.apache.thrift.meta_data.FieldMetaData("error", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getUserOnlineStatus_result.class, metaDataMap);
    }

    public getUserOnlineStatus_result() {
    }

    public getUserOnlineStatus_result(
      List<Boolean> success,
      error error)
    {
      this();
      this.success = success;
      this.error = error;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getUserOnlineStatus_result(getUserOnlineStatus_result other) {
      if (other.isSetSuccess()) {
        List<Boolean> __this__success = new ArrayList<Boolean>(other.success);
        this.success = __this__success;
      }
      if (other.isSetError()) {
        this.error = new error(other.error);
      }
    }

    public getUserOnlineStatus_result deepCopy() {
      return new getUserOnlineStatus_result(this);
    }

    @Override
    public void clear() {
      this.success = null;
      this.error = null;
    }

    public int getSuccessSize() {
      return (this.success == null) ? 0 : this.success.size();
    }

    public java.util.Iterator<Boolean> getSuccessIterator() {
      return (this.success == null) ? null : this.success.iterator();
    }

    public void addToSuccess(boolean elem) {
      if (this.success == null) {
        this.success = new ArrayList<Boolean>();
      }
      this.success.add(elem);
    }

    public List<Boolean> getSuccess() {
      return this.success;
    }

    public getUserOnlineStatus_result setSuccess(List<Boolean> 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 error getError() {
      return this.error;
    }

    public getUserOnlineStatus_result setError(error error) {
      this.error = error;
      return this;
    }

    public void unsetError() {
      this.error = null;
    }

    /** Returns true if field error is set (has been assigned a value) and false otherwise */
    public boolean isSetError() {
      return this.error != null;
    }

    public void setErrorIsSet(boolean value) {
      if (!value) {
        this.error = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((List<Boolean>)value);
        }
        break;

      case ERROR:
        if (value == null) {
          unsetError();
        } else {
          setError((error)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case ERROR:
        return getError();

      }
      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();
      case ERROR:
        return isSetError();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof getUserOnlineStatus_result)
        return this.equals((getUserOnlineStatus_result)that);
      return false;
    }

    public boolean equals(getUserOnlineStatus_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;
      }

      boolean this_present_error = true && this.isSetError();
      boolean that_present_error = true && that.isSetError();
      if (this_present_error || that_present_error) {
        if (!(this_present_error && that_present_error))
          return false;
        if (!this.error.equals(that.error))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean present_success = true && (isSetSuccess());
      list.add(present_success);
      if (present_success)
        list.add(success);

      boolean present_error = true && (isSetError());
      list.add(present_error);
      if (present_error)
        list.add(error);

      return list.hashCode();
    }

    @Override
    public int compareTo(getUserOnlineStatus_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;
        }
      }
      lastComparison = Boolean.valueOf(isSetError()).compareTo(other.isSetError());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetError()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.error, other.error);
        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("getUserOnlineStatus_result(");
      boolean first = true;

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("error:");
      if (this.error == null) {
        sb.append("null");
      } else {
        sb.append(this.error);
      }
      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 getUserOnlineStatus_resultStandardSchemeFactory implements SchemeFactory {
      public getUserOnlineStatus_resultStandardScheme getScheme() {
        return new getUserOnlineStatus_resultStandardScheme();
      }
    }

    private static class getUserOnlineStatus_resultStandardScheme extends StandardScheme<getUserOnlineStatus_result> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, getUserOnlineStatus_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.LIST) {
                {
                  org.apache.thrift.protocol.TList _list16 = iprot.readListBegin();
                  struct.success = new ArrayList<Boolean>(_list16.size);
                  boolean _elem17;
                  for (int _i18 = 0; _i18 < _list16.size; ++_i18)
                  {
                    _elem17 = iprot.readBool();
                    struct.success.add(_elem17);
                  }
                  iprot.readListEnd();
                }
                struct.setSuccessIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 1: // ERROR
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.error = new error();
                struct.error.read(iprot);
                struct.setErrorIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, getUserOnlineStatus_result struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.success != null) {
          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.BOOL, struct.success.size()));
            for (boolean _iter19 : struct.success)
            {
              oprot.writeBool(_iter19);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
        if (struct.error != null) {
          oprot.writeFieldBegin(ERROR_FIELD_DESC);
          struct.error.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class getUserOnlineStatus_resultTupleSchemeFactory implements SchemeFactory {
      public getUserOnlineStatus_resultTupleScheme getScheme() {
        return new getUserOnlineStatus_resultTupleScheme();
      }
    }

    private static class getUserOnlineStatus_resultTupleScheme extends TupleScheme<getUserOnlineStatus_result> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, getUserOnlineStatus_result struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetSuccess()) {
          optionals.set(0);
        }
        if (struct.isSetError()) {
          optionals.set(1);
        }
        oprot.writeBitSet(optionals, 2);
        if (struct.isSetSuccess()) {
          {
            oprot.writeI32(struct.success.size());
            for (boolean _iter20 : struct.success)
            {
              oprot.writeBool(_iter20);
            }
          }
        }
        if (struct.isSetError()) {
          struct.error.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, getUserOnlineStatus_result struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(2);
        if (incoming.get(0)) {
          {
            org.apache.thrift.protocol.TList _list21 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.BOOL, iprot.readI32());
            struct.success = new ArrayList<Boolean>(_list21.size);
            boolean _elem22;
            for (int _i23 = 0; _i23 < _list21.size; ++_i23)
            {
              _elem22 = iprot.readBool();
              struct.success.add(_elem22);
            }
          }
          struct.setSuccessIsSet(true);
        }
        if (incoming.get(1)) {
          struct.error = new error();
          struct.error.read(iprot);
          struct.setErrorIsSet(true);
        }
      }
    }

  }

  public static class sendMessageWithOneOfflineMessage_args implements org.apache.thrift.TBase<sendMessageWithOneOfflineMessage_args, sendMessageWithOneOfflineMessage_args._Fields>, java.io.Serializable, Cloneable, Comparable<sendMessageWithOneOfflineMessage_args>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("sendMessageWithOneOfflineMessage_args");

    private static final org.apache.thrift.protocol.TField USER_ID_COLLECTION_FIELD_DESC = new org.apache.thrift.protocol.TField("userIdCollection", org.apache.thrift.protocol.TType.LIST, (short)1);
    private static final org.apache.thrift.protocol.TField CMD_FIELD_DESC = new org.apache.thrift.protocol.TField("cmd", org.apache.thrift.protocol.TType.I16, (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.STRING, (short)3);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new sendMessageWithOneOfflineMessage_argsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new sendMessageWithOneOfflineMessage_argsTupleSchemeFactory());
    }

    public List<UserId> userIdCollection; // required
    public short cmd; // required
    public String 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 {
      USER_ID_COLLECTION((short)1, "userIdCollection"),
      CMD((short)2, "cmd"),
      MESSAGE((short)3, "message");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      static {
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static _Fields findByThriftId(int fieldId) {
        switch(fieldId) {
          case 1: // USER_ID_COLLECTION
            return USER_ID_COLLECTION;
          case 2: // CMD
            return CMD;
          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
    private static final int __CMD_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.USER_ID_COLLECTION, new org.apache.thrift.meta_data.FieldMetaData("userIdCollection", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.LIST          , "UserIdCollection")));
      tmpMap.put(_Fields.CMD, new org.apache.thrift.meta_data.FieldMetaData("cmd", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16)));
      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)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(sendMessageWithOneOfflineMessage_args.class, metaDataMap);
    }

    public sendMessageWithOneOfflineMessage_args() {
    }

    public sendMessageWithOneOfflineMessage_args(
      List<UserId> userIdCollection,
      short cmd,
      String message)
    {
      this();
      this.userIdCollection = userIdCollection;
      this.cmd = cmd;
      setCmdIsSet(true);
      this.message = message;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public sendMessageWithOneOfflineMessage_args(sendMessageWithOneOfflineMessage_args other) {
      __isset_bitfield = other.__isset_bitfield;
      if (other.isSetUserIdCollection()) {
        this.userIdCollection = other.userIdCollection;
      }
      this.cmd = other.cmd;
      if (other.isSetMessage()) {
        this.message = other.message;
      }
    }

    public sendMessageWithOneOfflineMessage_args deepCopy() {
      return new sendMessageWithOneOfflineMessage_args(this);
    }

    @Override
    public void clear() {
      this.userIdCollection = null;
      setCmdIsSet(false);
      this.cmd = 0;
      this.message = null;
    }

    public int getUserIdCollectionSize() {
      return (this.userIdCollection == null) ? 0 : this.userIdCollection.size();
    }

    public java.util.Iterator<UserId> getUserIdCollectionIterator() {
      return (this.userIdCollection == null) ? null : this.userIdCollection.iterator();
    }

    public void addToUserIdCollection(UserId elem) {
      if (this.userIdCollection == null) {
        this.userIdCollection = new ArrayList<UserId>();
      }
      this.userIdCollection.add(elem);
    }

    public List<UserId> getUserIdCollection() {
      return this.userIdCollection;
    }

    public sendMessageWithOneOfflineMessage_args setUserIdCollection(List<UserId> userIdCollection) {
      this.userIdCollection = userIdCollection;
      return this;
    }

    public void unsetUserIdCollection() {
      this.userIdCollection = null;
    }

    /** Returns true if field userIdCollection is set (has been assigned a value) and false otherwise */
    public boolean isSetUserIdCollection() {
      return this.userIdCollection != null;
    }

    public void setUserIdCollectionIsSet(boolean value) {
      if (!value) {
        this.userIdCollection = null;
      }
    }

    public short getCmd() {
      return this.cmd;
    }

    public sendMessageWithOneOfflineMessage_args setCmd(short cmd) {
      this.cmd = cmd;
      setCmdIsSet(true);
      return this;
    }

    public void unsetCmd() {
      __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __CMD_ISSET_ID);
    }

    /** Returns true if field cmd is set (has been assigned a value) and false otherwise */
    public boolean isSetCmd() {
      return EncodingUtils.testBit(__isset_bitfield, __CMD_ISSET_ID);
    }

    public void setCmdIsSet(boolean value) {
      __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __CMD_ISSET_ID, value);
    }

    public String getMessage() {
      return this.message;
    }

    public sendMessageWithOneOfflineMessage_args 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 void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case USER_ID_COLLECTION:
        if (value == null) {
          unsetUserIdCollection();
        } else {
          setUserIdCollection((List<UserId>)value);
        }
        break;

      case CMD:
        if (value == null) {
          unsetCmd();
        } else {
          setCmd((Short)value);
        }
        break;

      case MESSAGE:
        if (value == null) {
          unsetMessage();
        } else {
          setMessage((String)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case USER_ID_COLLECTION:
        return getUserIdCollection();

      case CMD:
        return Short.valueOf(getCmd());

      case MESSAGE:
        return getMessage();

      }
      throw new IllegalStateException();
    }

    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
    public boolean isSet(_Fields field) {
      if (field == null) {
        throw new IllegalArgumentException();
      }

      switch (field) {
      case USER_ID_COLLECTION:
        return isSetUserIdCollection();
      case CMD:
        return isSetCmd();
      case MESSAGE:
        return isSetMessage();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof sendMessageWithOneOfflineMessage_args)
        return this.equals((sendMessageWithOneOfflineMessage_args)that);
      return false;
    }

    public boolean equals(sendMessageWithOneOfflineMessage_args that) {
      if (that == null)
        return false;

      boolean this_present_userIdCollection = true && this.isSetUserIdCollection();
      boolean that_present_userIdCollection = true && that.isSetUserIdCollection();
      if (this_present_userIdCollection || that_present_userIdCollection) {
        if (!(this_present_userIdCollection && that_present_userIdCollection))
          return false;
        if (!this.userIdCollection.equals(that.userIdCollection))
          return false;
      }

      boolean this_present_cmd = true;
      boolean that_present_cmd = true;
      if (this_present_cmd || that_present_cmd) {
        if (!(this_present_cmd && that_present_cmd))
          return false;
        if (this.cmd != that.cmd)
          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;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean present_userIdCollection = true && (isSetUserIdCollection());
      list.add(present_userIdCollection);
      if (present_userIdCollection)
        list.add(userIdCollection);

      boolean present_cmd = true;
      list.add(present_cmd);
      if (present_cmd)
        list.add(cmd);

      boolean present_message = true && (isSetMessage());
      list.add(present_message);
      if (present_message)
        list.add(message);

      return list.hashCode();
    }

    @Override
    public int compareTo(sendMessageWithOneOfflineMessage_args other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetUserIdCollection()).compareTo(other.isSetUserIdCollection());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetUserIdCollection()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userIdCollection, other.userIdCollection);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetCmd()).compareTo(other.isSetCmd());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetCmd()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cmd, other.cmd);
        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;
        }
      }
      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("sendMessageWithOneOfflineMessage_args(");
      boolean first = true;

      sb.append("userIdCollection:");
      if (this.userIdCollection == null) {
        sb.append("null");
      } else {
        sb.append(this.userIdCollection);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("cmd:");
      sb.append(this.cmd);
      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
    }

    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
      try {
        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(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 sendMessageWithOneOfflineMessage_argsStandardSchemeFactory implements SchemeFactory {
      public sendMessageWithOneOfflineMessage_argsStandardScheme getScheme() {
        return new sendMessageWithOneOfflineMessage_argsStandardScheme();
      }
    }

    private static class sendMessageWithOneOfflineMessage_argsStandardScheme extends StandardScheme<sendMessageWithOneOfflineMessage_args> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, sendMessageWithOneOfflineMessage_args struct) throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true)
        {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
            break;
          }
          switch (schemeField.id) {
            case 1: // USER_ID_COLLECTION
              if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
                {
                  org.apache.thrift.protocol.TList _list24 = iprot.readListBegin();
                  struct.userIdCollection = new ArrayList<UserId>(_list24.size);
                  UserId _elem25;
                  for (int _i26 = 0; _i26 < _list24.size; ++_i26)
                  {
                    _elem25 = new UserId();
                    _elem25.read(iprot);
                    struct.userIdCollection.add(_elem25);
                  }
                  iprot.readListEnd();
                }
                struct.setUserIdCollectionIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 2: // CMD
              if (schemeField.type == org.apache.thrift.protocol.TType.I16) {
                struct.cmd = iprot.readI16();
                struct.setCmdIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 3: // 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;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, sendMessageWithOneOfflineMessage_args struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.userIdCollection != null) {
          oprot.writeFieldBegin(USER_ID_COLLECTION_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.userIdCollection.size()));
            for (UserId _iter27 : struct.userIdCollection)
            {
              _iter27.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
        oprot.writeFieldBegin(CMD_FIELD_DESC);
        oprot.writeI16(struct.cmd);
        oprot.writeFieldEnd();
        if (struct.message != null) {
          oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
          oprot.writeString(struct.message);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class sendMessageWithOneOfflineMessage_argsTupleSchemeFactory implements SchemeFactory {
      public sendMessageWithOneOfflineMessage_argsTupleScheme getScheme() {
        return new sendMessageWithOneOfflineMessage_argsTupleScheme();
      }
    }

    private static class sendMessageWithOneOfflineMessage_argsTupleScheme extends TupleScheme<sendMessageWithOneOfflineMessage_args> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, sendMessageWithOneOfflineMessage_args struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetUserIdCollection()) {
          optionals.set(0);
        }
        if (struct.isSetCmd()) {
          optionals.set(1);
        }
        if (struct.isSetMessage()) {
          optionals.set(2);
        }
        oprot.writeBitSet(optionals, 3);
        if (struct.isSetUserIdCollection()) {
          {
            oprot.writeI32(struct.userIdCollection.size());
            for (UserId _iter28 : struct.userIdCollection)
            {
              _iter28.write(oprot);
            }
          }
        }
        if (struct.isSetCmd()) {
          oprot.writeI16(struct.cmd);
        }
        if (struct.isSetMessage()) {
          oprot.writeString(struct.message);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, sendMessageWithOneOfflineMessage_args struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(3);
        if (incoming.get(0)) {
          {
            org.apache.thrift.protocol.TList _list29 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
            struct.userIdCollection = new ArrayList<UserId>(_list29.size);
            UserId _elem30;
            for (int _i31 = 0; _i31 < _list29.size; ++_i31)
            {
              _elem30 = new UserId();
              _elem30.read(iprot);
              struct.userIdCollection.add(_elem30);
            }
          }
          struct.setUserIdCollectionIsSet(true);
        }
        if (incoming.get(1)) {
          struct.cmd = iprot.readI16();
          struct.setCmdIsSet(true);
        }
        if (incoming.get(2)) {
          struct.message = iprot.readString();
          struct.setMessageIsSet(true);
        }
      }
    }

  }

  public static class sendMessageWithOneOfflineMessage_result implements org.apache.thrift.TBase<sendMessageWithOneOfflineMessage_result, sendMessageWithOneOfflineMessage_result._Fields>, java.io.Serializable, Cloneable, Comparable<sendMessageWithOneOfflineMessage_result>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("sendMessageWithOneOfflineMessage_result");

    private static final org.apache.thrift.protocol.TField ERROR_FIELD_DESC = new org.apache.thrift.protocol.TField("error", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new sendMessageWithOneOfflineMessage_resultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new sendMessageWithOneOfflineMessage_resultTupleSchemeFactory());
    }

    public error error; // required

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
      ERROR((short)1, "error");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      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: // ERROR
            return ERROR;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches 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.ERROR, new org.apache.thrift.meta_data.FieldMetaData("error", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(sendMessageWithOneOfflineMessage_result.class, metaDataMap);
    }

    public sendMessageWithOneOfflineMessage_result() {
    }

    public sendMessageWithOneOfflineMessage_result(
      error error)
    {
      this();
      this.error = error;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public sendMessageWithOneOfflineMessage_result(sendMessageWithOneOfflineMessage_result other) {
      if (other.isSetError()) {
        this.error = new error(other.error);
      }
    }

    public sendMessageWithOneOfflineMessage_result deepCopy() {
      return new sendMessageWithOneOfflineMessage_result(this);
    }

    @Override
    public void clear() {
      this.error = null;
    }

    public error getError() {
      return this.error;
    }

    public sendMessageWithOneOfflineMessage_result setError(error error) {
      this.error = error;
      return this;
    }

    public void unsetError() {
      this.error = null;
    }

    /** Returns true if field error is set (has been assigned a value) and false otherwise */
    public boolean isSetError() {
      return this.error != null;
    }

    public void setErrorIsSet(boolean value) {
      if (!value) {
        this.error = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case ERROR:
        if (value == null) {
          unsetError();
        } else {
          setError((error)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case ERROR:
        return getError();

      }
      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 ERROR:
        return isSetError();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof sendMessageWithOneOfflineMessage_result)
        return this.equals((sendMessageWithOneOfflineMessage_result)that);
      return false;
    }

    public boolean equals(sendMessageWithOneOfflineMessage_result that) {
      if (that == null)
        return false;

      boolean this_present_error = true && this.isSetError();
      boolean that_present_error = true && that.isSetError();
      if (this_present_error || that_present_error) {
        if (!(this_present_error && that_present_error))
          return false;
        if (!this.error.equals(that.error))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean present_error = true && (isSetError());
      list.add(present_error);
      if (present_error)
        list.add(error);

      return list.hashCode();
    }

    @Override
    public int compareTo(sendMessageWithOneOfflineMessage_result other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetError()).compareTo(other.isSetError());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetError()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.error, other.error);
        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("sendMessageWithOneOfflineMessage_result(");
      boolean first = true;

      sb.append("error:");
      if (this.error == null) {
        sb.append("null");
      } else {
        sb.append(this.error);
      }
      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 sendMessageWithOneOfflineMessage_resultStandardSchemeFactory implements SchemeFactory {
      public sendMessageWithOneOfflineMessage_resultStandardScheme getScheme() {
        return new sendMessageWithOneOfflineMessage_resultStandardScheme();
      }
    }

    private static class sendMessageWithOneOfflineMessage_resultStandardScheme extends StandardScheme<sendMessageWithOneOfflineMessage_result> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, sendMessageWithOneOfflineMessage_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 1: // ERROR
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.error = new error();
                struct.error.read(iprot);
                struct.setErrorIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, sendMessageWithOneOfflineMessage_result struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.error != null) {
          oprot.writeFieldBegin(ERROR_FIELD_DESC);
          struct.error.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class sendMessageWithOneOfflineMessage_resultTupleSchemeFactory implements SchemeFactory {
      public sendMessageWithOneOfflineMessage_resultTupleScheme getScheme() {
        return new sendMessageWithOneOfflineMessage_resultTupleScheme();
      }
    }

    private static class sendMessageWithOneOfflineMessage_resultTupleScheme extends TupleScheme<sendMessageWithOneOfflineMessage_result> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, sendMessageWithOneOfflineMessage_result struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetError()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetError()) {
          struct.error.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, sendMessageWithOneOfflineMessage_result struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          struct.error = new error();
          struct.error.read(iprot);
          struct.setErrorIsSet(true);
        }
      }
    }

  }

  public static class sendMessageToRoom_args implements org.apache.thrift.TBase<sendMessageToRoom_args, sendMessageToRoom_args._Fields>, java.io.Serializable, Cloneable, Comparable<sendMessageToRoom_args>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("sendMessageToRoom_args");

    private static final org.apache.thrift.protocol.TField NSP_FIELD_DESC = new org.apache.thrift.protocol.TField("nsp", org.apache.thrift.protocol.TType.STRING, (short)1);
    private static final org.apache.thrift.protocol.TField ROOM_FIELD_DESC = new org.apache.thrift.protocol.TField("room", org.apache.thrift.protocol.TType.STRING, (short)2);
    private static final org.apache.thrift.protocol.TField CMD_FIELD_DESC = new org.apache.thrift.protocol.TField("cmd", org.apache.thrift.protocol.TType.I16, (short)3);
    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)4);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new sendMessageToRoom_argsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new sendMessageToRoom_argsTupleSchemeFactory());
    }

    public String nsp; // required
    public String room; // required
    public short cmd; // required
    public String 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 {
      NSP((short)1, "nsp"),
      ROOM((short)2, "room"),
      CMD((short)3, "cmd"),
      MESSAGE((short)4, "message");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      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: // NSP
            return NSP;
          case 2: // ROOM
            return ROOM;
          case 3: // CMD
            return CMD;
          case 4: // 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
    private static final int __CMD_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.NSP, new org.apache.thrift.meta_data.FieldMetaData("nsp", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      tmpMap.put(_Fields.ROOM, new org.apache.thrift.meta_data.FieldMetaData("room", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
      tmpMap.put(_Fields.CMD, new org.apache.thrift.meta_data.FieldMetaData("cmd", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16)));
      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)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(sendMessageToRoom_args.class, metaDataMap);
    }

    public sendMessageToRoom_args() {
    }

    public sendMessageToRoom_args(
      String nsp,
      String room,
      short cmd,
      String message)
    {
      this();
      this.nsp = nsp;
      this.room = room;
      this.cmd = cmd;
      setCmdIsSet(true);
      this.message = message;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public sendMessageToRoom_args(sendMessageToRoom_args other) {
      __isset_bitfield = other.__isset_bitfield;
      if (other.isSetNsp()) {
        this.nsp = other.nsp;
      }
      if (other.isSetRoom()) {
        this.room = other.room;
      }
      this.cmd = other.cmd;
      if (other.isSetMessage()) {
        this.message = other.message;
      }
    }

    public sendMessageToRoom_args deepCopy() {
      return new sendMessageToRoom_args(this);
    }

    @Override
    public void clear() {
      this.nsp = null;
      this.room = null;
      setCmdIsSet(false);
      this.cmd = 0;
      this.message = null;
    }

    public String getNsp() {
      return this.nsp;
    }

    public sendMessageToRoom_args setNsp(String nsp) {
      this.nsp = nsp;
      return this;
    }

    public void unsetNsp() {
      this.nsp = null;
    }

    /** Returns true if field nsp is set (has been assigned a value) and false otherwise */
    public boolean isSetNsp() {
      return this.nsp != null;
    }

    public void setNspIsSet(boolean value) {
      if (!value) {
        this.nsp = null;
      }
    }

    public String getRoom() {
      return this.room;
    }

    public sendMessageToRoom_args setRoom(String room) {
      this.room = room;
      return this;
    }

    public void unsetRoom() {
      this.room = null;
    }

    /** Returns true if field room is set (has been assigned a value) and false otherwise */
    public boolean isSetRoom() {
      return this.room != null;
    }

    public void setRoomIsSet(boolean value) {
      if (!value) {
        this.room = null;
      }
    }

    public short getCmd() {
      return this.cmd;
    }

    public sendMessageToRoom_args setCmd(short cmd) {
      this.cmd = cmd;
      setCmdIsSet(true);
      return this;
    }

    public void unsetCmd() {
      __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __CMD_ISSET_ID);
    }

    /** Returns true if field cmd is set (has been assigned a value) and false otherwise */
    public boolean isSetCmd() {
      return EncodingUtils.testBit(__isset_bitfield, __CMD_ISSET_ID);
    }

    public void setCmdIsSet(boolean value) {
      __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __CMD_ISSET_ID, value);
    }

    public String getMessage() {
      return this.message;
    }

    public sendMessageToRoom_args 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 void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case NSP:
        if (value == null) {
          unsetNsp();
        } else {
          setNsp((String)value);
        }
        break;

      case ROOM:
        if (value == null) {
          unsetRoom();
        } else {
          setRoom((String)value);
        }
        break;

      case CMD:
        if (value == null) {
          unsetCmd();
        } else {
          setCmd((Short)value);
        }
        break;

      case MESSAGE:
        if (value == null) {
          unsetMessage();
        } else {
          setMessage((String)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case NSP:
        return getNsp();

      case ROOM:
        return getRoom();

      case CMD:
        return Short.valueOf(getCmd());

      case MESSAGE:
        return getMessage();

      }
      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 NSP:
        return isSetNsp();
      case ROOM:
        return isSetRoom();
      case CMD:
        return isSetCmd();
      case MESSAGE:
        return isSetMessage();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof sendMessageToRoom_args)
        return this.equals((sendMessageToRoom_args)that);
      return false;
    }

    public boolean equals(sendMessageToRoom_args that) {
      if (that == null)
        return false;

      boolean this_present_nsp = true && this.isSetNsp();
      boolean that_present_nsp = true && that.isSetNsp();
      if (this_present_nsp || that_present_nsp) {
        if (!(this_present_nsp && that_present_nsp))
          return false;
        if (!this.nsp.equals(that.nsp))
          return false;
      }

      boolean this_present_room = true && this.isSetRoom();
      boolean that_present_room = true && that.isSetRoom();
      if (this_present_room || that_present_room) {
        if (!(this_present_room && that_present_room))
          return false;
        if (!this.room.equals(that.room))
          return false;
      }

      boolean this_present_cmd = true;
      boolean that_present_cmd = true;
      if (this_present_cmd || that_present_cmd) {
        if (!(this_present_cmd && that_present_cmd))
          return false;
        if (this.cmd != that.cmd)
          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;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean present_nsp = true && (isSetNsp());
      list.add(present_nsp);
      if (present_nsp)
        list.add(nsp);

      boolean present_room = true && (isSetRoom());
      list.add(present_room);
      if (present_room)
        list.add(room);

      boolean present_cmd = true;
      list.add(present_cmd);
      if (present_cmd)
        list.add(cmd);

      boolean present_message = true && (isSetMessage());
      list.add(present_message);
      if (present_message)
        list.add(message);

      return list.hashCode();
    }

    @Override
    public int compareTo(sendMessageToRoom_args other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetNsp()).compareTo(other.isSetNsp());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetNsp()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nsp, other.nsp);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetRoom()).compareTo(other.isSetRoom());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetRoom()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.room, other.room);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetCmd()).compareTo(other.isSetCmd());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetCmd()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cmd, other.cmd);
        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;
        }
      }
      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("sendMessageToRoom_args(");
      boolean first = true;

      sb.append("nsp:");
      if (this.nsp == null) {
        sb.append("null");
      } else {
        sb.append(this.nsp);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("room:");
      if (this.room == null) {
        sb.append("null");
      } else {
        sb.append(this.room);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("cmd:");
      sb.append(this.cmd);
      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
    }

    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
      try {
        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(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 sendMessageToRoom_argsStandardSchemeFactory implements SchemeFactory {
      public sendMessageToRoom_argsStandardScheme getScheme() {
        return new sendMessageToRoom_argsStandardScheme();
      }
    }

    private static class sendMessageToRoom_argsStandardScheme extends StandardScheme<sendMessageToRoom_args> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, sendMessageToRoom_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: // NSP
              if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                struct.nsp = iprot.readString();
                struct.setNspIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 2: // ROOM
              if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                struct.room = iprot.readString();
                struct.setRoomIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 3: // CMD
              if (schemeField.type == org.apache.thrift.protocol.TType.I16) {
                struct.cmd = iprot.readI16();
                struct.setCmdIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 4: // 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;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, sendMessageToRoom_args struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.nsp != null) {
          oprot.writeFieldBegin(NSP_FIELD_DESC);
          oprot.writeString(struct.nsp);
          oprot.writeFieldEnd();
        }
        if (struct.room != null) {
          oprot.writeFieldBegin(ROOM_FIELD_DESC);
          oprot.writeString(struct.room);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldBegin(CMD_FIELD_DESC);
        oprot.writeI16(struct.cmd);
        oprot.writeFieldEnd();
        if (struct.message != null) {
          oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
          oprot.writeString(struct.message);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class sendMessageToRoom_argsTupleSchemeFactory implements SchemeFactory {
      public sendMessageToRoom_argsTupleScheme getScheme() {
        return new sendMessageToRoom_argsTupleScheme();
      }
    }

    private static class sendMessageToRoom_argsTupleScheme extends TupleScheme<sendMessageToRoom_args> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, sendMessageToRoom_args struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetNsp()) {
          optionals.set(0);
        }
        if (struct.isSetRoom()) {
          optionals.set(1);
        }
        if (struct.isSetCmd()) {
          optionals.set(2);
        }
        if (struct.isSetMessage()) {
          optionals.set(3);
        }
        oprot.writeBitSet(optionals, 4);
        if (struct.isSetNsp()) {
          oprot.writeString(struct.nsp);
        }
        if (struct.isSetRoom()) {
          oprot.writeString(struct.room);
        }
        if (struct.isSetCmd()) {
          oprot.writeI16(struct.cmd);
        }
        if (struct.isSetMessage()) {
          oprot.writeString(struct.message);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, sendMessageToRoom_args struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(4);
        if (incoming.get(0)) {
          struct.nsp = iprot.readString();
          struct.setNspIsSet(true);
        }
        if (incoming.get(1)) {
          struct.room = iprot.readString();
          struct.setRoomIsSet(true);
        }
        if (incoming.get(2)) {
          struct.cmd = iprot.readI16();
          struct.setCmdIsSet(true);
        }
        if (incoming.get(3)) {
          struct.message = iprot.readString();
          struct.setMessageIsSet(true);
        }
      }
    }

  }

  public static class sendMessageToRoom_result implements org.apache.thrift.TBase<sendMessageToRoom_result, sendMessageToRoom_result._Fields>, java.io.Serializable, Cloneable, Comparable<sendMessageToRoom_result>   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("sendMessageToRoom_result");

    private static final org.apache.thrift.protocol.TField ERROR_FIELD_DESC = new org.apache.thrift.protocol.TField("error", org.apache.thrift.protocol.TType.STRUCT, (short)1);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
      schemes.put(StandardScheme.class, new sendMessageToRoom_resultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new sendMessageToRoom_resultTupleSchemeFactory());
    }

    public error error; // required

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
      ERROR((short)1, "error");

      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

      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: // ERROR
            return ERROR;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches 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.ERROR, new org.apache.thrift.meta_data.FieldMetaData("error", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(sendMessageToRoom_result.class, metaDataMap);
    }

    public sendMessageToRoom_result() {
    }

    public sendMessageToRoom_result(
      error error)
    {
      this();
      this.error = error;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public sendMessageToRoom_result(sendMessageToRoom_result other) {
      if (other.isSetError()) {
        this.error = new error(other.error);
      }
    }

    public sendMessageToRoom_result deepCopy() {
      return new sendMessageToRoom_result(this);
    }

    @Override
    public void clear() {
      this.error = null;
    }

    public error getError() {
      return this.error;
    }

    public sendMessageToRoom_result setError(error error) {
      this.error = error;
      return this;
    }

    public void unsetError() {
      this.error = null;
    }

    /** Returns true if field error is set (has been assigned a value) and false otherwise */
    public boolean isSetError() {
      return this.error != null;
    }

    public void setErrorIsSet(boolean value) {
      if (!value) {
        this.error = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case ERROR:
        if (value == null) {
          unsetError();
        } else {
          setError((error)value);
        }
        break;

      }
    }

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case ERROR:
        return getError();

      }
      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 ERROR:
        return isSetError();
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (that instanceof sendMessageToRoom_result)
        return this.equals((sendMessageToRoom_result)that);
      return false;
    }

    public boolean equals(sendMessageToRoom_result that) {
      if (that == null)
        return false;

      boolean this_present_error = true && this.isSetError();
      boolean that_present_error = true && that.isSetError();
      if (this_present_error || that_present_error) {
        if (!(this_present_error && that_present_error))
          return false;
        if (!this.error.equals(that.error))
          return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean present_error = true && (isSetError());
      list.add(present_error);
      if (present_error)
        list.add(error);

      return list.hashCode();
    }

    @Override
    public int compareTo(sendMessageToRoom_result other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetError()).compareTo(other.isSetError());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetError()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.error, other.error);
        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("sendMessageToRoom_result(");
      boolean first = true;

      sb.append("error:");
      if (this.error == null) {
        sb.append("null");
      } else {
        sb.append(this.error);
      }
      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 sendMessageToRoom_resultStandardSchemeFactory implements SchemeFactory {
      public sendMessageToRoom_resultStandardScheme getScheme() {
        return new sendMessageToRoom_resultStandardScheme();
      }
    }

    private static class sendMessageToRoom_resultStandardScheme extends StandardScheme<sendMessageToRoom_result> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, sendMessageToRoom_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 1: // ERROR
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.error = new error();
                struct.error.read(iprot);
                struct.setErrorIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, sendMessageToRoom_result struct) throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.error != null) {
          oprot.writeFieldBegin(ERROR_FIELD_DESC);
          struct.error.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class sendMessageToRoom_resultTupleSchemeFactory implements SchemeFactory {
      public sendMessageToRoom_resultTupleScheme getScheme() {
        return new sendMessageToRoom_resultTupleScheme();
      }
    }

    private static class sendMessageToRoom_resultTupleScheme extends TupleScheme<sendMessageToRoom_result> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, sendMessageToRoom_result struct) throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetError()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetError()) {
          struct.error.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, sendMessageToRoom_result struct) throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          struct.error = new error();
          struct.error.read(iprot);
          struct.setErrorIsSet(true);
        }
      }
    }

  }

}
