Skip to content

Commit

Permalink
Add a sleep to allow sink to commit the transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
harishreedharan committed Aug 19, 2014
1 parent 120b81e commit e3110b9
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package org.apache.spark.streaming.flume.sink

import java.net.InetSocketAddress
import java.util.concurrent.atomic.AtomicInteger
import java.util.concurrent.{CountDownLatch, Executors}
import java.util.concurrent.{TimeUnit, CountDownLatch, Executors}

import scala.collection.JavaConversions._
import scala.concurrent.{ExecutionContext, Future}
Expand Down Expand Up @@ -118,8 +118,7 @@ class SparkSinkSuite extends TestSuiteBase {
transceiversAndClients.foreach(x => {
Future {
val client = x._2
var events: EventBatch = null
events = client.getEventBatch(1000)
val events = client.getEventBatch(1000)
if (!failSome || counter.getAndIncrement() % 2 == 0) {
client.ack(events.getSequenceNumber)
} else {
Expand All @@ -137,6 +136,7 @@ class SparkSinkSuite extends TestSuiteBase {
}
})
batchCounter.await()
TimeUnit.SECONDS.sleep(1) // Allow the sink to commit the transactions.
executorContext.shutdown()
if(failSome) {
assert(availableChannelSlots(channel) === 3000)
Expand Down

0 comments on commit e3110b9

Please sign in to comment.