Пример #1
0
  // FIXME (2014.08) Legacy support for TAgentStat Thrift DTO stored directly into hbase.
  private List<AgentStat> readAgentStatThriftDto(byte[] tAgentStatByteArray) throws TException {
    // CompactProtocol used
    TDeserializer deserializer = new TDeserializer(factory);
    TAgentStat tAgentStat = new TAgentStat();
    deserializer.deserialize(tAgentStat, tAgentStatByteArray);
    TJvmGc gc = tAgentStat.getGc();
    if (gc == null) {
      return Collections.emptyList();
    }
    AgentStatMemoryGcBo.Builder memoryGcBoBuilder =
        new AgentStatMemoryGcBo.Builder(
            tAgentStat.getAgentId(), tAgentStat.getStartTimestamp(), tAgentStat.getTimestamp());
    memoryGcBoBuilder.gcType(gc.getType().name());
    memoryGcBoBuilder.jvmMemoryHeapUsed(gc.getJvmMemoryHeapUsed());
    memoryGcBoBuilder.jvmMemoryHeapMax(gc.getJvmMemoryHeapMax());
    memoryGcBoBuilder.jvmMemoryNonHeapUsed(gc.getJvmMemoryNonHeapUsed());
    memoryGcBoBuilder.jvmMemoryNonHeapMax(gc.getJvmMemoryNonHeapMax());
    memoryGcBoBuilder.jvmGcOldCount(gc.getJvmGcOldCount());
    memoryGcBoBuilder.jvmGcOldTime(gc.getJvmGcOldTime());

    AgentStat agentStat = new AgentStat();
    agentStat.setMemoryGc(memoryGcBoBuilder.build());

    List<AgentStat> result = new ArrayList<AgentStat>(1);
    result.add(agentStat);
    return result;
  }
Пример #2
0
 public static List<IteratorSetting> decodeIteratorSettings(byte[] enc) {
   TDeserializer tdser = new TDeserializer(new TBinaryProtocol.Factory());
   IteratorConfig ic = new IteratorConfig();
   try {
     tdser.deserialize(ic, enc);
   } catch (TException e) {
     throw new RuntimeException(e);
   }
   return toIteratorSettings(ic);
 }
Пример #3
0
  /** Deserialized a serialized form of a Thrift data structure to its object form */
  private <T extends TBase> void deserializeThrift(T result, byte[] thriftData)
      throws ImpalaException {
    // TODO: avoid creating deserializer for each query?
    TDeserializer deserializer = new TDeserializer(protocolFactory);

    try {
      deserializer.deserialize(result, thriftData);
    } catch (TException e) {
      throw new InternalException(e.getMessage());
    }
  }
 private static KeyRange keyRangeFromString(String st) {
   assert st != null;
   TDeserializer deserializer = new TDeserializer(new TBinaryProtocol.Factory());
   KeyRange keyRange = new KeyRange();
   try {
     deserializer.deserialize(keyRange, Hex.hexToBytes(st));
   } catch (TException e) {
     throw new RuntimeException(e);
   }
   return keyRange;
 }
 private static SlicePredicate predicateFromString(String st) {
   assert st != null;
   TDeserializer deserializer = new TDeserializer(new TBinaryProtocol.Factory());
   SlicePredicate predicate = new SlicePredicate();
   try {
     deserializer.deserialize(predicate, Hex.hexToBytes(st));
   } catch (TException e) {
     throw new RuntimeException(e);
   }
   return predicate;
 }