Players can join the room only for 60 seconds and post which I will be adding bots to the room if there are insufficient players in the room and game will start.
I want to run a timer here for each room created and track the timer for each room created to check end of timer.
I looked into taskscheduler
Code: Select all
taskHandle = sfs.getTaskScheduler().scheduleAtFixedRate(new TimeRunner(), 0, 1, TimeUnit.SECONDS);
But I will have to run a task scheduler for each room created and I believe it is not a efficient approach.
So how do I deal with this scenario and run a timer for each room? I would need room references as well to add bots to the room