|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.nitido.throttle.BlockingCountThrottle
public class BlockingCountThrottle
Provides throttling that will block the requesting threads if the limit has been reached (and will continue to block the thread until it can enter the throttle or the wait time expires).
Constructor Summary | |
---|---|
BlockingCountThrottle(int allowCount)
Default constructor. |
Method Summary | |
---|---|
boolean |
enterThrottle(long maxWaitTime)
Method to call when entering the throttle. |
void |
exitThrottle()
Method to be called when exiting the code block that was throttle controlled |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BlockingCountThrottle(int allowCount)
allowCount
- The number of requests that can go through this throttle at the same
timeMethod Detail |
---|
public boolean enterThrottle(long maxWaitTime)
This method is designed intentionally to force the caller to specify the maxWaitTime. It does not allow a thread to be block forever until the resource is available. It is because we need to ensure the calling thread will eventually return and continue processing.
enterThrottle
in interface BlockingThrottle
maxWaitTime
- The maximum time to wait for entering the throttle. It must be a long
integer larger than 0. If it is smaller than that, this throttle will
fail the request.
public void exitThrottle()
exitThrottle
in interface BlockingThrottle
|
Nitido NiM 2.5 Java API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1999-2009 Nitido Inc. Proprietary and Confidential. All Rights Reserved.