batchMultiSet

对multiSet函数的批量封装。该函数并发地向server发送异步请求,并等待结果。如果有任意一个请求失败,就提前终止并抛出异常。

  1. /**
  2. * Batch set multiple value under the same hash key.
  3. * Will terminate immediately if any error occurs.
  4. * @param tableName TableHandler name
  5. * @param items list of items.
  6. * @param ttl_seconds time to live in seconds,
  7. * 0 means no ttl. default value is 0.
  8. * @throws PException throws exception if any error occurs.
  9. *
  10. * Notice: the method is not atomic, that means, maybe some keys succeed but some keys failed.
  11. */
  12. public void batchMultiSet(String tableName, List<HashKeyData> items, int ttl_seconds) throws PException;
  13. public void batchMultiSet(String tableName, List<HashKeyData> items) throws PException;

注:

  • 提供了两个版本的接口,其中第一个接口可以指定TTL时间。
  • 参数:需传入TableName、Items;选择性传入TTL。
  • 返回值:无。
  • 异常:如果出现异常,譬如网络错误、超时错误、服务端错误等,会抛出 PException。
  • 注意:该方法不是原子的,有可能出现部分成功部分失败的情况,只要任意一个失败都会抛出异常。