@@ -35,9 +35,14 @@ import org.gorpipe.gor.util.DataUtil
3535import org .slf4j .{Logger , LoggerFactory }
3636
3737import java .nio .file .{Files , Path , Paths }
38+ import scala .collection .mutable
39+
40+ object RefSeqFromConfig {
41+ var downloadTriggered : util.Map [String , java.lang.Boolean ] =
42+ new java.util.concurrent.ConcurrentHashMap [String , java.lang.Boolean ]
43+ }
3844
3945class RefSeqFromChromSeq (ipath : String , fileReader : FileReader ) extends RefSeq {
40- protected var download_triggered = false
4146 private val GOR_REFSEQ_CACHE_FOLDER = System .getProperty(" gor.refseq.cache.folder" )
4247 private val GOR_REFSEQ_CACHE_DOWNLOAD = Option (System .getProperty(" gor.refseq.cache.download" , " true" )).exists(_.toBoolean)
4348
@@ -66,8 +71,8 @@ class RefSeqFromChromSeq(ipath : String, fileReader : FileReader) extends RefSeq
6671 if (Files .exists(fullCachePath)) {
6772 log.debug(" Using cached reference build {}" , fullCachePath.toString)
6873 return fullCachePath.toString
69- } else if (GOR_REFSEQ_CACHE_DOWNLOAD && ! download_triggered ) {
70- download_triggered = true // Only trigger download once per client
74+ } else if (GOR_REFSEQ_CACHE_DOWNLOAD && ( RefSeqFromConfig .downloadTriggered.putIfAbsent(fullRefPath.toString, true ) == null ) ) {
75+ // Only trigger download once per client
7176 triggerRefSeqDownload(fullRefPath, fullCachePath)
7277 }
7378 }
0 commit comments