Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(372)

Unified Diff: pkg/pool/lib/pool.dart

Issue 411263006: Add timeout tests for the pool package. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/pool/CHANGELOG.md ('k') | pkg/pool/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/pool/lib/pool.dart
diff --git a/pkg/pool/lib/pool.dart b/pkg/pool/lib/pool.dart
index 36a29c86dca0951753d3bd7159a6f66f1f3dff4d..61482e3f2ba46944a6a3cd13c924d1fbdc77036a 100644
--- a/pkg/pool/lib/pool.dart
+++ b/pkg/pool/lib/pool.dart
@@ -40,14 +40,14 @@ class Pool {
Timer _timer;
/// The amount of time to wait before timing out the pending resources.
- Duration _timeout;
+ final Duration _timeout;
/// Creates a new pool with the given limit on how many resources may be
/// allocated at once.
///
/// If [timeout] is passed, then if that much time passes without any activity
- /// all pending [request] futures will throw an exception. This is indented
- /// to avoid deadlocks.
+ /// all pending [request] futures will throw a [TimeoutException]. This is
+ /// intended to avoid deadlocks.
Pool(this._maxAllocatedResources, {Duration timeout})
: _timeout = timeout;
@@ -106,8 +106,11 @@ class Pool {
/// emit exceptions.
void _onTimeout() {
for (var completer in _requestedResources) {
- completer.completeError("Pool deadlock: all resources have been "
- "allocated for too long.", new Chain.current());
+ completer.completeError(
+ new TimeoutException("Pool deadlock: all resources have been "
+ "allocated for too long.",
+ _timeout),
+ new Chain.current());
}
_requestedResources.clear();
_timer = null;
« no previous file with comments | « pkg/pool/CHANGELOG.md ('k') | pkg/pool/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698