asyncSortKeyCount

异步获取某个HashKey下所有SortKey的个数。

  1. public static interface SortKeyCountListener extends GenericFutureListener<Future<Long>> {
  2. /**
  3. * This function will be called when listened asyncSortKeyCount future is done.
  4. * @param future the listened future
  5. * @throws Exception
  6. *
  7. * Notice: User shouldn't do any operations that may block or time-consuming
  8. */
  9. @Override
  10. public void operationComplete(Future<Long> future) throws Exception;
  11. }
  12.  
  13. /**
  14. * Count the sortkeys for a specific hashKey, async version
  15. * @param hashKey used to decide which partition the key may exist
  16. * should not be null or empty
  17. * @param timeout how long will the operation timeout in milliseconds.
  18. * if timeout > 0, it is a timeout value for current op,
  19. * else the timeout value in the configuration file will be used.
  20. *
  21. * @return the future for current op
  22. *
  23. * Future return:
  24. * On success: the count result for the hashKey
  25. * On failure: a throwable, which is an instance of PException
  26. *
  27. * Thread safety:
  28. * The api is thread safe.
  29. * All the listeners for the same table are guaranteed to be dispatched in the same thread, so all the
  30. * listeners for the same future are guaranteed to be executed as the same order as the listeners added.
  31. * But listeners for different tables are not guaranteed to be dispatched in the same thread.
  32. */
  33. public Future<Long> asyncSortKeyCount(byte[] hashKey, int timeout/*ms*/);

注:

  • 参数:需传入HashKey、timeout。
    • timeout单位为毫秒,如果<=0,表示使用配置文件中的默认超时。
  • 返回值:Future
    • 返回结果为HashKey下所有SortKey的个数。