kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jun...@apache.org
Subject svn commit: r1394164 - /incubator/kafka/branches/0.8/core/src/main/scala/kafka/producer/async/ProducerSendThread.scala
Date Thu, 04 Oct 2012 17:29:34 GMT
Author: junrao
Date: Thu Oct  4 17:29:33 2012
New Revision: 1394164

URL: http://svn.apache.org/viewvc?rev=1394164&view=rev
Log:
ProducerSendThread calls ListBuffer.size a whole bunch. That is a O(n) operation; patched
by David Arthur; reviewed by Jun Rao; kafka-456

Modified:
    incubator/kafka/branches/0.8/core/src/main/scala/kafka/producer/async/ProducerSendThread.scala

Modified: incubator/kafka/branches/0.8/core/src/main/scala/kafka/producer/async/ProducerSendThread.scala
URL: http://svn.apache.org/viewvc/incubator/kafka/branches/0.8/core/src/main/scala/kafka/producer/async/ProducerSendThread.scala?rev=1394164&r1=1394163&r2=1394164&view=diff
==============================================================================
--- incubator/kafka/branches/0.8/core/src/main/scala/kafka/producer/async/ProducerSendThread.scala
(original)
+++ incubator/kafka/branches/0.8/core/src/main/scala/kafka/producer/async/ProducerSendThread.scala
Thu Oct  4 17:29:33 2012
@@ -99,12 +99,13 @@ class ProducerSendThread[K,V](val thread
   }
 
   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)
     }
   }
 



Mime
View raw message