[
https://issues.apache.org/jira/browse/HTRACE-119?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Masatake Iwasaki updated HTRACE-119:
------------------------------------
Attachment: HTRACE-119.003.patch
bq. I wonder if, rather than changing the code path in TraceScope, we could
just add a NullScope#detach function that does nothing (and returns null). It
seems like this would fix the problem, while not allowing double detach when
tracing was on.
It would be better to override the method in NullScope as you say because the
intension is clearer, though I think 001 and 002 works exactly same way because
TraceScope.span is never to be null if it is not NullScope. I think {{close}}
also should be overriden in NullScope to be consistent. How about 003 patch I
attached?
bq. There is still an issue with us not catching double detach when NullScope
is in use, but perhaps the optimization of avoiding creating a new scope when
tracing is off outweighs that concern?
I think so. HTrace should keep its load low as far as possible especially when
tracing is not started. Users are encouraged to cover the code path with
tracing started in unit tests.
> detach of NullScope singleton should not fail
> ---------------------------------------------
>
> Key: HTRACE-119
> URL: https://issues.apache.org/jira/browse/HTRACE-119
> Project: HTrace
> Issue Type: Bug
> Affects Versions: master
> Reporter: Masatake Iwasaki
> Assignee: Masatake Iwasaki
> Attachments: HTRACE-119.001.patch, HTRACE-119.002.patch,
> HTRACE-119.003.patch
>
>
> The {{detach}} method of NullScope singleton is possible to be called
> multiple times by users avoiding conditionals by the assumption that
> NullScope#close and NullScope#detach results in no-op. Calling {{detach}} of
> NullScope singleton multiple times throws RuntimeException by HTRACE-101 now.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)