processHandler<T> method

Future<T> processHandler<T>(
  1. Handler handler,
  2. Duration timeout
)

The 3 functions below this line are the main interface to the running handlers on the connection. Each function MUST queue the handlers in the pool and MUST tidy up the connection (leave _handler null) before finishing.

Implementation

Future<T> processHandler<T>(Handler handler, Duration timeout) {
  return pool.withResource(() async {
    try {
      var ret = await _processHandler<T>(handler).timeout(timeout);
      return ret;
    } finally {
      _handler = null;
    }
  });
}