Summary:
- it should be possible to specify a zero timeout if the pendingTaskQueue
is already full
Reviewed By: marc
Test Plan:
- Tested in search
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665406
13f79535-47bb-0310-9956-
ffa450edef68
}
if (pendingTaskCountMax_ > 0 && (tasks_.size() >= pendingTaskCountMax_)) {
-
- if (canSleep()) {
-
+ if (canSleep() && timeout >= 0) {
while (pendingTaskCountMax_ > 0 && tasks_.size() >= pendingTaskCountMax_) {
monitor_.wait(timeout);
}
* @param task The task to queue for execution
*
* @param timeout Time to wait in milliseconds to add a task when a pending-task-count
- * is specified
+ * is specified. Specific cases:
+ * timeout = 0 : Wait forever to queue task.
+ * timeout = -1 : Return immediately if pending task count exceeds specified max
*
* @throws TooManyPendingTasksException Pending task count exceeds max pending task count
*/