Package org.apache.thrift

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


    /**
     * 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

          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

  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

  }

  @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

  }

  @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

    }

    @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

  }

  @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

  }

  @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

                } catch ( ClassNotFoundException e ) {
                    throw new RpcException( RpcException.SERIALIZATION_EXCEPTION, e.getMessage(), e );
                }
            }

            TBase args;

            try {
                args = ( TBase ) clazz.newInstance();
            } catch ( InstantiationException e ) {
                throw new RpcException( RpcException.SERIALIZATION_EXCEPTION, e.getMessage(), e );
            } catch ( IllegalAccessException e ) {
                throw new RpcException( RpcException.SERIALIZATION_EXCEPTION, e.getMessage(), e );
            }

            try{
                args.read( protocol );
                protocol.readMessageEnd();
            } catch ( TException e ) {
                throw new RpcException( RpcException.SERIALIZATION_EXCEPTION, e.getMessage(), e );
            }

            List<Object> parameters = new ArrayList<Object>();
            List<Class<?>> parameterTypes =new ArrayList<Class<?>>();
            int index = 1;

            while ( true ) {

                TFieldIdEnum fieldIdEnum = args.fieldForId( index++ );

                if ( fieldIdEnum == null ) { break; }

                String fieldName = fieldIdEnum.getFieldName();
View Full Code Here

TOP

Related Classes of org.apache.thrift.TBase

Copyright © 2018 www.massapicom. 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.