@Override
    public void handle(Future<?> future, Object context) {
      @SuppressWarnings("unchecked")
      Future<Result<byte[]>> afuture = (Future<Result<byte[]>>) future;
      UserActiveDetail.Builder mergeValueBuilder = Recommend.UserActiveDetail.newBuilder();

      UserActiveDetail oldValueHeap = null;
      try {
        Result<byte[]> res = afuture.get();
        if (res.isSuccess() && res.getResult() != null) {
          oldValueHeap = Recommend.UserActiveDetail.parseFrom(res.getResult());
        }
      } catch (Exception e) {
        logger.error(e.getMessage(), e);
      }

      if (debug) {
        if (oldValueHeap == null) {
          logger.info("get key=" + key + ",from tde ,but null");
        } else {
          logger.info("get key=" + key + ",from tde success");
        }
      }
      mergeToHeap(values, oldValueHeap, mergeValueBuilder);
      Save(mergeValueBuilder);
    }
Ejemplo n.º 2
0
    @Override
    public void handle(Future<?> future, Object context) {
      @SuppressWarnings("unchecked")
      Future<Result<byte[]>> afuture = (Future<Result<byte[]>>) future;
      UserActiveHistory.Builder mergeValueBuilder = Recommend.UserActiveHistory.newBuilder();
      UserActiveHistory oldValueHeap = null;
      try {
        Result<byte[]> res = afuture.get();
        if (res.isSuccess() && res.getResult() != null) {
          oldValueHeap = Recommend.UserActiveHistory.parseFrom(res.getResult());
        }
      } catch (Exception e) {
        logger.error(e.getMessage(), e);
      }

      mergeToHeap(this.values, oldValueHeap, mergeValueBuilder);
      Save(mergeValueBuilder);
    }