Nitido Inc.

com.nitido.throttle
Interface BlockingThrottle

All Known Implementing Classes:
BlockingCountThrottle

public interface BlockingThrottle

The base interface for all throttle objects that will block the requesting threads. It declares the basic methods required for a blocking throttle object. All the implementations should be thread-safe and can be invoked by multiple threads at the same time.


Method Summary
 boolean enterThrottle(long maxWaitTime)
          Method to be called when entering the code block that needs the throttling control.
 void exitThrottle()
          Method to be called when exiting the code block that was throttle controlled
 

Method Detail

enterThrottle

boolean enterThrottle(long maxWaitTime)
Method to be called when entering the code block that needs the throttling control.

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.

If an implementation really needs to support "forever blocking" (which is NOT recommended), the developer should provide another way to wake up all the blocking threads when the application is being shut down.

Parameters:
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.
Returns:
true if the thread can enter the throttle within the maxWaitTime limit, false if otherwise.

exitThrottle

void exitThrottle()
Method to be called when exiting the code block that was throttle controlled


Nitido NiM 2.5 Java API

These JavaDoc pages are generated for release/nim_2_5-2.5.44

Copyright © 1999-2009 Nitido Inc.    Proprietary and Confidential.    All Rights Reserved.