This patch moves connecting, logging in and setting up the comparator into a new method. If we have previously created the connection the method returns without reconnecting. The patch also correctly closes the connection when the recordreader's close method is called.
can you rename setupConnection to maybeConnect?
+1 the rest
Stu adds that it may be more hadoop-y to throw IOException on connection error, than RuntimeException
Renamed the method as suggested.
Throwing IOException would be preferable, but can't neatly propagate that up to nextKeyValue(). Would have to add it to the computeNext() method and that would conflict the AbstractIterator interface. Could make a nasty hack of it but I think that's outside the scope of this patch.
Committed to trunk