Resilient
|
Allow at most a fixed amount of executions to happen at the same time. More...
#include <blockingfixedconcurrentexecutionsstrategy.hpp>
Public Member Functions | |
BlockingFixedConcurrentExecutionsStrategy (unsigned long maxConcurrentExecutions, std::chrono::microseconds maxWaitTime) | |
Construct a new BlockingFixedConcurrentExecutionsStrategy object. More... | |
virtual Variant< MaxConcurrentPermit, PermitAcquireTimeout > | acquire () override |
Acquire a single permit to execute a request. More... | |
virtual void | release (MaxConcurrentPermit) override |
Release a permit that was previously acquired. More... | |
Allow at most a fixed amount of executions to happen at the same time.
If less then the fixed amount of executions is happening concurrently the strategy allows immediately to execute. If the limit has been reached then it waits for one of the current executions to terminate up to a timeout, after which it returns an error.
|
inline |
Construct a new BlockingFixedConcurrentExecutionsStrategy object.
maxConcurrentExecutions | The maximum number of concurrent execution |
maxWaitTime | How long to wait to be allowed to run before returning an error. |
|
inlineoverridevirtual |
Acquire a single permit to execute a request.
acquire()
is called before invoking the function to wait for a permit. This call may block.
release()
is called with the permit. Implements resilient::IRateLimiterStrategy< MaxConcurrentPermit, PermitAcquireTimeout >.
|
inlineoverridevirtual |
Release a permit that was previously acquired.
release()
is called after the invoked function returned or throwed.
permit_type | The permit returned by acquire() . |
Implements resilient::IRateLimiterStrategy< MaxConcurrentPermit, PermitAcquireTimeout >.