Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

relates to FLUME-583 #9

Open
wants to merge 1 commit into from

1 participant

Jonas Adler
Jonas Adler

unnecessary loop removed, removed statements that are always false, removed unreachable code

Jonas Adler jadlr commented on the diff
src/java/com/cloudera/flume/handlers/text/Cursor.java
@@ -351,28 +351,11 @@ public class Cursor {
madeProgress = true;
// need char encoder to find line breaks in buf.
- lastChannelPos += (rd < 0 ? 0 : rd); // rd == -1 if at end of
Jonas Adler
jadlr added a note

rd can never be <=0 in this loop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Jonas Adler jadlr commented on the diff
src/java/com/cloudera/flume/handlers/text/Cursor.java
((6 lines not shown))
// stream.
-
- int lastRd = 0;
- boolean progress = false;
- do {
Jonas Adler
jadlr added a note

this loop runs only once

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Jonas Adler jadlr commented on the diff
src/java/com/cloudera/flume/handlers/text/Cursor.java
((6 lines not shown))
// stream.
-
- int lastRd = 0;
- boolean progress = false;
- do {
-
- if (lastRd == -1 && rd == -1) {
- return true;
Jonas Adler
jadlr added a note

unreachable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Sunghwan Cho wingsh referenced this pull request from a commit
K gnkr8 Fixes #9 1c53d38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 29, 2011
  1. Jonas Adler

    removed unreachable code

    jadlr authored jonas committed
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 21 deletions.
  1. +4 −21 src/java/com/cloudera/flume/handlers/text/Cursor.java
25 src/java/com/cloudera/flume/handlers/text/Cursor.java
View
@@ -351,28 +351,11 @@ private boolean readAllFromChannel() throws IOException, InterruptedException {
madeProgress = true;
// need char encoder to find line breaks in buf.
- lastChannelPos += (rd < 0 ? 0 : rd); // rd == -1 if at end of
Jonas Adler
jadlr added a note

rd can never be <=0 in this loop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ lastChannelPos += rd;
// stream.
-
- int lastRd = 0;
- boolean progress = false;
- do {
Jonas Adler
jadlr added a note

this loop runs only once

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
-
- if (lastRd == -1 && rd == -1) {
- return true;
Jonas Adler
jadlr added a note

unreachable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
- }
-
- buf.flip();
-
- // extract lines
- extractLines(buf);
-
- lastRd = rd;
- } while (progress); // / potential race
-
- // if the amount read catches up to the size of the file, we can fall
- // out and let another fileChannel be read. If the last buffer isn't
- // read, then it remain in the byte buffer.
+ buf.flip();
+ // extract lines
+ extractLines(buf);
}
Something went wrong with that request. Please try again.