MCPcopy Index your code
hub / github.com/OpenTSDB/opentsdb / markSerialized

Method markSerialized

src/stats/QueryStats.java:341–372  ·  view source on GitHub ↗

Marks a query as completed with the given HTTP code with exception and moves it from the running map to the cache, updating the cache if it already existed. @param response The HTTP response to log @param exception The exception thrown

(final HttpResponseStatus response, 
      final Throwable exception)

Source from the content-addressed store, hash-verified

339 * @param exception The exception thrown
340 */
341 public void markSerialized(final HttpResponseStatus response,
342 final Throwable exception) {
343 this.exception = exception;
344 this.response = response;
345
346 query_completed_ts = DateTime.currentTimeMillis();
347 overall_stats.put(QueryStat.PROCESSING_PRE_WRITE_TIME, DateTime.nanoTime() - query_start_ns);
348 synchronized (running_queries) {
349 if (!running_queries.containsKey(this.hashCode())) {
350 if (!ENABLE_DUPLICATES) {
351 LOG.warn("Query was already marked as complete: " + this);
352 }
353 }
354 running_queries.remove(hashCode());
355 if (LOG.isDebugEnabled()) {
356 LOG.debug("Removed completed query " + remote_address + " with hash " +
357 hashCode() + " on thread " + Thread.currentThread().getId());
358 }
359 }
360
361 aggQueryStats();
362
363 final int cache_hash = this.hashCode() ^ response.toString().hashCode();
364 synchronized (completed_queries) {
365 final QueryStats old_query = completed_queries.getIfPresent(cache_hash);
366 if (old_query == null) {
367 completed_queries.put(cache_hash, this);
368 } else {
369 old_query.executed++;
370 }
371 }
372 }
373
374 /**
375 * Marks the query as complete and logs it to the proper logs. This is called

Callers 5

markCompleteTimeoutMethod · 0.95
executedMethod · 0.95
executedTwiceMethod · 0.95
callMethod · 0.80

Calls 8

currentTimeMillisMethod · 0.95
nanoTimeMethod · 0.95
hashCodeMethod · 0.95
aggQueryStatsMethod · 0.95
putMethod · 0.80
removeMethod · 0.65
getIdMethod · 0.65
toStringMethod · 0.45

Tested by 3

markCompleteTimeoutMethod · 0.76
executedMethod · 0.76
executedTwiceMethod · 0.76