Browse Source

Use ConcurrentHashMap for timetableList

Multiple requests may be processed at the same time and could otherwise cause problems (concurrent write operations)
pull/17/head
Hannes Braun 9 months ago
parent
commit
fb6291792d
Signed by: hannesbraun
GPG Key ID: 7B6557E1DFD685BE
  1. 4
      src/main/kotlin/org/mosad/thecitadelofricks/controller/CacheController.kt

4
src/main/kotlin/org/mosad/thecitadelofricks/controller/CacheController.kt

@ -33,9 +33,9 @@ import org.slf4j.Logger
import org.slf4j.LoggerFactory
import java.io.*
import java.util.*
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.Executors
import kotlin.collections.ArrayList
import kotlin.collections.HashMap
import kotlin.collections.HashSet
import kotlin.concurrent.scheduleAtFixedRate
import kotlin.time.Duration
@ -53,7 +53,7 @@ class CacheController {
var courseList = CoursesList(CoursesMeta(), sortedMapOf())
var mensaMenu = MensaMenu(MensaMeta(0, ""), MensaWeek(), MensaWeek())
var timetableList = HashMap<String, TimetableCourseWeek>() // this list contains all timetables
var timetableList = ConcurrentHashMap<String, TimetableCourseWeek>() // this list contains all timetables
/**
* get a timetable, since they may not be cached, we need to make sure it's cached, otherwise download

Loading…
Cancel
Save

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close