pjfanning commented on code in PR #226:
URL:
https://github.com/apache/incubator-pekko-connectors/pull/226#discussion_r1300070226
##########
kinesis/src/main/scala/org/apache/pekko/stream/connectors/kinesis/impl/KinesisSchedulerSourceStage.scala:
##########
@@ -81,8 +81,14 @@ private[kinesis] class KinesisSchedulerSourceStage(
override def shardRecordProcessor(): ShardRecordProcessor =
new ShardProcessor(newRecordCallback)
})
+ //Run the scheduler loop in a separate thread
+ val thread = new Thread(() => {
+ val result = Try {scheduler.run()}
+ callback.invoke(SchedulerShutdown(result))
+ }, s"KinesisSchedulerSource")
+ thread.setDaemon(true)
+ thread.start()
schedulerOpt = Some(scheduler)
- Future(scheduler.run()).onComplete(result =>
callback.invoke(SchedulerShutdown(result)))
Review Comment:
@jtjeferreira I'm not dead set against using a short lived daemon thread
like you have in the current version of the PR but did you check the Future
blocking approach?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]