[ 
https://issues.apache.org/jira/browse/HTRACE-6?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14217856#comment-14217856
 ] 

Colin Patrick McCabe edited comment on HTRACE-6 at 12/17/14 2:39 AM:
---------------------------------------------------------------------

\[original proposal was making TraceRunnable a Comparable\]

Hi [~billie.rinaldi], interesting idea.

I'm not completely sure what comparing two {{TraceRunnable}} objects should 
mean.  Should they be considered alike if the {{Span}} objects they contain are 
alike?  We don't have any way of comparing the {{Runnable}} objects that 
{{TraceRunnable}} holds ({{Runnable}} doesn't implement {{Comparable}}).  And 
comparing by description just feels fragile, since it would be so easy to reuse 
the same description in multiple {{TraceRunnable}} objects.

This leads to another question, which is whether {{Span}} should implement 
Comparable (it doesn't, currently... it doesn't even implement {{hashCode}} or 
{{equals}}).  I think it's reasonable for {{Span}} objects to be compared by 
their {{spanId}}.  With {{TraceRunnable}}, I feel less sure, just because I 
don't have any intuitive idea of what it should "mean" to compare them.

Perhaps this is a case where you should just use a {{Comparator}}?  Or am I 
missing a really natural way to write a {{compareTo}} function here?


was (Author: cmccabe):
Hi [~billie.rinaldi], interesting idea.

I'm not completely sure what comparing two {{TraceRunnable}} objects should 
mean.  Should they be considered alike if the {{Span}} objects they contain are 
alike?  We don't have any way of comparing the {{Runnable}} objects that 
{{TraceRunnable}} holds ({{Runnable}} doesn't implement {{Comparable}}).  And 
comparing by description just feels fragile, since it would be so easy to reuse 
the same description in multiple {{TraceRunnable}} objects.

This leads to another question, which is whether {{Span}} should implement 
Comparable (it doesn't, currently... it doesn't even implement {{hashCode}} or 
{{equals}}).  I think it's reasonable for {{Span}} objects to be compared by 
their {{spanId}}.  With {{TraceRunnable}}, I feel less sure, just because I 
don't have any intuitive idea of what it should "mean" to compare them.

Perhaps this is a case where you should just use a {{Comparator}}?  Or am I 
missing a really natural way to write a {{compareTo}} function here?

> TraceRunnable should expose the underlying Runnable
> ---------------------------------------------------
>
>                 Key: HTRACE-6
>                 URL: https://issues.apache.org/jira/browse/HTRACE-6
>             Project: HTrace
>          Issue Type: Wish
>            Reporter: Billie Rinaldi
>         Attachments: HTRACE-6.1.patch, HTRACE-6.2.patch
>
>
> TraceRunnable should expose the wrapped Runnable objects.
> Accumulo needs this in order to insert the TraceRunnable objects into a 
> priority queue.   The comparator for the priority queue needs access to the 
> underlying objects.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to