private void Save(Recommend.UserActiveDetail.Builder mergeValueBuilder) {
      if (debug) {
        printOut(mergeValueBuilder.build());
      }

      Future<Result<Void>> future = null;
      UserActiveDetail pbValue = mergeValueBuilder.build();

      for (ClientAttr clientEntry : mtClientList) {
        TairOption putopt = new TairOption(clientEntry.getTimeout(), (short) 0, dataExpireTime);
        try {
          future =
              clientEntry
                  .getClient()
                  .putAsync((short) nsTableId, key.getBytes(), pbValue.toByteArray(), putopt);
          clientEntry
              .getClient()
              .notifyFuture(
                  future,
                  putCallBack,
                  new UpdateCallBackContext(clientEntry, key, pbValue.toByteArray(), putopt));
        } catch (Exception e) {
          logger.error(e.getMessage(), e);
        }
        break;
      }
    }
예제 #2
0
 public void excute() {
   try {
     ClientAttr clientEntry = mtClientList.get(0);
     TairOption opt = new TairOption(clientEntry.getTimeout());
     Future<Result<byte[]>> future =
         clientEntry.getClient().getAsync((short) nsTableId, key.getBytes(), opt);
     clientEntry.getClient().notifyFuture(future, this, clientEntry);
   } catch (Exception e) {
     logger.error(e.toString());
   }
 }
    public void excute() {
      if (debug) {
        logger.info("get key=" + key + ",in tde");
      }

      ClientAttr clientEntry = mtClientList.get(0);
      TairOption opt = new TairOption(clientEntry.getTimeout());
      Future<Result<byte[]>> future;
      try {
        future = clientEntry.getClient().getAsync((short) nsTableId, key.getBytes(), opt);
        clientEntry.getClient().notifyFuture(future, this, clientEntry);
      } catch (Exception e) {
        logger.error(e.getMessage(), e);
      }
    }
예제 #4
0
 private void Save(UserActiveHistory.Builder mergeValueBuilder) {
   UserActiveHistory putValue = mergeValueBuilder.build();
   for (ClientAttr clientEntry : mtClientList) {
     TairOption putopt = new TairOption(clientEntry.getTimeout(), (short) 0, dataExpireTime);
     try {
       Future<Result<Void>> future =
           clientEntry
               .getClient()
               .putAsync((short) nsTableId, this.key.getBytes(), putValue.toByteArray(), putopt);
       clientEntry
           .getClient()
           .notifyFuture(
               future,
               putCallBack,
               new UpdateCallBackContext(clientEntry, key, putValue.toByteArray(), putopt));
     } catch (Exception e) {
       logger.error(e.getMessage(), e);
     }
   }
 }