hehuiyuan commented on issue #24270: [SPARK-27343][KAFKA][SS]Avoid hardcoded 
for spark-sql-kafka-0-10
URL: https://github.com/apache/spark/pull/24270#issuecomment-484511110
 
 
   @srowen  
   ```
     private[kafka010] val PRODUCER_CACHE_TIMEOUT =
       ConfigBuilder("spark.kafka.producer.cache.timeout")
         .doc("The expire time to remove the unused producers.")
         .timeConf(TimeUnit.MILLISECONDS)
         .createWithDefaultString("10m")
   ```
   This result is 600000,which is used to reduce unit 
conversion(MINUTE->MILLISECONDS).
   
   ```scala
   private lazy val cacheExpireTimeout: Long = Option(SparkEnv.get)
       .map(_.conf.get(PRODUCER_CACHE_TIMEOUT))
       .getOrElse(defaultCacheExpireTimeout)
   
   private lazy val guavaCache: LoadingCache[Seq[(String, Object)], Producer] =
       CacheBuilder.newBuilder().expireAfterAccess(cacheExpireTimeout, 
TimeUnit.MILLISECONDS)
         .removalListener(removalListener)
         .build[Seq[(String, Object)], Producer](cacheLoader)
   ``` 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to