Examples of TBase


Examples of com.facebook.thrift.TBase

   * If matchBytewise is set, then both input and output are written as JSON, and equality of it
   * asserted, too.
   */
  private static void assertReadBack(TBase s, boolean matchBytewise) throws Exception {
    String string = write(compactProtocolFactory, s);
    TBase dummy = s.getClass().newInstance();
    read(compactProtocolFactory, string, dummy);
    String dummyString = write(compactProtocolFactory, dummy);
    if (matchBytewise) {
      assertEquals(string, dummyString);
    }
    assertTrue(dummy.equals(s));
  }
View Full Code Here

Examples of org.apache.thrift.TBase

  }

  @Override
  public TBase read(Kryo kryo, Input input, Class<TBase> tBaseClass) {
    try {
      TBase prototype = tBaseClass.newInstance();
      int tSize = input.readInt(true);
      byte[] barr = new byte[tSize];
      input.readBytes(barr);
      deserializer.deserialize(prototype, barr);
      return prototype;
View Full Code Here

Examples of org.apache.thrift.TBase

    /**
     * get the first pending call if it exists, else null
     */
    private TBase getCall() {
      try {
        TBase ret = pendingCalls.get(0);
        return (ret);
      } catch (IndexOutOfBoundsException e) {
        return null;
      }
    }
View Full Code Here

Examples of org.apache.thrift.TBase

          if (!shutdown && (now < nextDispatchTime))
            continue;

          // send pending requests/releases
          while (!pendingCalls.isEmpty()) {
            TBase call = getCall();
            if (call == null) {
              continue;
            }

            init();
            dispatchCall(call);
            resetRetryState();

            // we can only remove the first element if
            // it is the call we just dispatched
            TBase currentCall = getCall();
            if (currentCall == call)
              pendingCalls.remove(0);
          }

View Full Code Here

Examples of org.apache.thrift.TBase

  private class IncomingCallExecutor extends Thread {
    @Override
    public void run() {
      while (running) {
        try {
          TBase call = incoming.take();
          if (call instanceof grantResource_args) {
            grantResource_args args = (grantResource_args) call;
            iface.grantResource(args.handle, args.granted);
          } else if (call instanceof revokeResource_args) {
            revokeResource_args args = (revokeResource_args) call;
View Full Code Here

Examples of org.apache.thrift.TBase

  }

  @Override
  protected Object getField(Object record, String name, int pos, Object state) {
    TFieldIdEnum f = ((TFieldIdEnum[])state)[pos];
    TBase struct = (TBase)record;
    if (struct.isSet(f))
      return struct.getFieldValue(f);
    return null;
  }
View Full Code Here

Examples of org.apache.thrift.TBase

  }

  @Override
  protected Object getField(Object record, String name, int pos, Object state) {
    TFieldIdEnum f = ((TFieldIdEnum[])state)[pos];
    TBase struct = (TBase)record;
    if (struct.isSet(f))
      return struct.getFieldValue(f);
    return null;
  }
View Full Code Here

Examples of org.apache.thrift.TBase

    }

    @Override
    public TBase read(Kryo kryo, Input input, Class<TBase> tBaseClass) {
        try {
            TBase prototype = tBaseClass.newInstance();
            int tSize = input.readInt(true);
            byte[] barr = new byte[tSize];
            input.readBytes(barr);
            deserializer.deserialize(prototype, barr);
            return prototype;
View Full Code Here

Examples of org.apache.thrift.TBase

  }

  @Override
  protected Object getField(Object record, String name, int pos, Object state) {
    TFieldIdEnum f = ((TFieldIdEnum[])state)[pos];
    TBase struct = (TBase)record;
    if (struct.isSet(f))
      return struct.getFieldValue(f);
    return null;
  }
View Full Code Here

Examples of org.apache.thrift.TBase

  }

  @Override
  protected Object getField(Object record, String name, int pos, Object state) {
    TFieldIdEnum f = ((TFieldIdEnum[])state)[pos];
    TBase struct = (TBase)record;
    if (struct.isSet(f))
      return struct.getFieldValue(f);
    return null;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.