Index: pkg/analysis_server/lib/src/status/get_handler.dart |
diff --git a/pkg/analysis_server/lib/src/status/get_handler.dart b/pkg/analysis_server/lib/src/status/get_handler.dart |
index c51e4826e392e840de7bd0a59839958379ab2fbb..898dda8b150543b09adc7b44dc58ca5597983b8a 100644 |
--- a/pkg/analysis_server/lib/src/status/get_handler.dart |
+++ b/pkg/analysis_server/lib/src/status/get_handler.dart |
@@ -184,10 +184,22 @@ class GetHandler { |
final Map<String, String> _overlayContents = <String, String>{}; |
/** |
+ * Handler for diagnostics requests. |
+ */ |
+ DiagnosticDomainHandler _diagnosticHandler; |
+ |
+ /** |
* Initialize a newly created handler for GET requests. |
*/ |
GetHandler(this._server, this._printBuffer); |
+ DiagnosticDomainHandler get diagnosticHandler { |
+ if (_diagnosticHandler == null) { |
+ _diagnosticHandler = new DiagnosticDomainHandler(_server.analysisServer); |
+ } |
+ return _diagnosticHandler; |
+ } |
+ |
/** |
* Return the active [CompletionDomainHandler] |
* or `null` if either analysis server is not running |
@@ -1484,14 +1496,11 @@ class GetHandler { |
* Write the status of the diagnostic domain to the given [buffer]. |
*/ |
void _writeDiagnosticStatus(StringBuffer buffer) { |
- DiagnosticDomainHandler handler = |
- new DiagnosticDomainHandler(_server.analysisServer); |
- |
var request = new DiagnosticGetDiagnosticsParams().toRequest('0'); |
var stopwatch = new Stopwatch(); |
stopwatch.start(); |
- var response = handler.handleRequest(request); |
+ var response = diagnosticHandler.handleRequest(request); |
stopwatch.stop(); |
int elapsedMs = stopwatch.elapsedMilliseconds; |