ProducerSendThread calls ListBuffer.size a whole bunch. That is a O(n) operation; patched by David Arthur; reviewed by Jun Rao; kafka-456

git-svn-id: https://svn.apache.org/repos/asf/incubator/kafka/branches/0.8@1394164 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jun Rao 2012-10-04 17:29:33 +00:00
parent 3bb1c16691
commit c42726cdaf
1 changed files with 4 additions and 3 deletions

View File

@ -99,12 +99,13 @@ class ProducerSendThread[K,V](val threadName: String,
}
def tryToHandle(events: Seq[ProducerData[K,V]]) {
val size = events.size
try {
debug("Handling " + events.size + " events")
if(events.size > 0)
debug("Handling " + size + " events")
if(size > 0)
handler.handle(events)
}catch {
case e => error("Error in handling batch of " + events.size + " events", e)
case e => error("Error in handling batch of " + size + " events", e)
}
}