Pool class
Manages an abstract pool of resources with a limit on how many may be in use at once.
When a resource is needed, the user should call request. When the returned future completes with a PoolResource, the resource may be allocated. Once the resource has been released, the user should call PoolResource.release. The pool will ensure that only a certain number of PoolResources may be allocated at once.
Constructors
Properties
- done → Future
-
A future that completes once the pool is closed and all its outstanding
resources have been released.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isClosed → bool
-
Whether close has been called.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
close(
) → Future - Closes the pool so that no more resources are requested.
-
forEach<
S, T> (Iterable< S> elements, FutureOr<T> action(S source), {bool onError(S item, Object error, StackTrace stack)?}) → Stream<T> -
Returns a Stream containing the result of
action
applied to each element ofelements
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
request(
) → Future< PoolResource> - Request a PoolResource.
-
toString(
) → String -
A string representation of this object.
inherited
-
withResource<
T> (FutureOr< T> callback()) → Future<T> -
Requests a resource for the duration of
callback
, which may return a Future.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited