cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ariel Weisberg (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CASSANDRA-9985) Introduce our own AbstractIterator
Date Thu, 06 Aug 2015 18:00:05 GMT

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

Ariel Weisberg edited comment on CASSANDRA-9985 at 8/6/15 5:59 PM:
-------------------------------------------------------------------

#1 seems less important. #2 seems important. My thinking is that this is library code we'll
never touch again so ugly isn't a great reason. Performance would be, but that would be trading
performance for problems down the road. If performance were the reason then maybe tying it
to assertions?

WRT to #2. In practice computeNext is definitely going to throw. Now what are the odds the
exception handling keeps the iterator in scope, and then comes back to try and use it? Not
so bad maybe?

{quote}
Iterator foo = bar.iterator();
while (foo.hasNext())
{
    try 
    {
        //stuff
    }
    catch (Exception e)
    {
        //Log or whatever
    }
}
{quote}
If we do #2 is #1 still a lot of code?


was (Author: aweisberg):
#1 seems less important. #2 seems important. My thinking is that this is library code we'll
never touch again so ugly isn't a great reason. Performance would be, but that would be trading
performance for problems down the road. If performance were the reason then maybe tying it
to assertions?

WRT to #2. In practice computeNext is definitely going to throw. Now what are the odds the
exception handling keeps the iterator in scope, and then comes back to try and use it? Not
so bad maybe?

Iterator foo = bar.iterator();

while (foo.hasNext())
{
try {
//stuff
}
catch (Exception e)
{
//Log or whatever
}
}

If we do #2 is #1 still a lot of code?

> Introduce our own AbstractIterator
> ----------------------------------
>
>                 Key: CASSANDRA-9985
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-9985
>             Project: Cassandra
>          Issue Type: Sub-task
>          Components: Core
>            Reporter: Benedict
>            Assignee: Benedict
>            Priority: Trivial
>             Fix For: 3.0.0 rc1
>
>
> The Guava AbstractIterator not only has unnecessary method call depth, it is difficult
to debug without attaching source. Since it's absolutely trivial to write our own, and it's
used widely within the codebase, I think we should do so.



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

Mime
View raw message