@@ -183,6 +183,8 @@ public class JitsiMeetConferenceImpl
183183 */
184184 private Future <?> conferenceStartTimeout ;
185185
186+ private final Object conferenceStartTimeoutLock = new Object ();
187+
186188 /**
187189 * Reconnect timer. Used to stop the conference if XMPP connection is not restored in a given time.
188190 */
@@ -304,7 +306,7 @@ public JitsiMeetConferenceImpl(
304306 this .jicofoServices = jicofoServices ;
305307 this .jvbVersion = jvbVersion ;
306308
307- rescheduleConferenceStartTimeout ();
309+ scheduleConferenceStartTimeout ();
308310
309311 visitorCodecs = new PreferenceAggregator (
310312 logger ,
@@ -784,11 +786,7 @@ private void onMemberJoined(@NotNull ChatRoomMember chatRoomMember)
784786
785787 synchronized (participantLock )
786788 {
787- if (conferenceStartTimeout != null )
788- {
789- conferenceStartTimeout .cancel (true );
790- conferenceStartTimeout = null ;
791- }
789+ cancelConferenceStartTimeout ();
792790 // Make sure it's still a member of the room.
793791 if (chatRoomMember .getChatRoom ().getChatMember (chatRoomMember .getOccupantJid ()) != chatRoomMember )
794792 {
@@ -1077,7 +1075,7 @@ else if (chatRoomMember != null
10771075 && BREAKOUT_SWITCHING_STATUS .equals (chatRoomMember .getPresence ().getStatus ()))
10781076 {
10791077 logger .info ("Member moving to breakout room, will not stop." );
1080- rescheduleConferenceStartTimeout ();
1078+ scheduleConferenceStartTimeout ();
10811079 }
10821080 else
10831081 {
@@ -2241,30 +2239,62 @@ private void rescheduleSingleParticipantTimeout()
22412239 logger .info ("Scheduled single person timeout." );
22422240 }
22432241
2242+ private void cancelConferenceStartTimeout ()
2243+ {
2244+ synchronized (conferenceStartTimeoutLock )
2245+ {
2246+ if (conferenceStartTimeout != null )
2247+ {
2248+ conferenceStartTimeout .cancel (true );
2249+ conferenceStartTimeout = null ;
2250+ }
2251+ }
2252+ }
2253+
22442254 /**
2245- * (Re)schedules conference start timeout.
2255+ * If there is a scheduled "conference start" timeout, cancel it and re-schedule with the configured delay. If
2256+ * there isn't one scheduled, doesn't do anything.
22462257 */
2247- private void rescheduleConferenceStartTimeout ()
2258+ public void rescheduleConferenceStartTimeout ()
22482259 {
2249- conferenceStartTimeout = TaskPools .getScheduledPool ().schedule (
2250- () ->
2251- {
2252- if (includeInStatistics )
2253- {
2254- logger .info ("Expiring due to initial timeout." );
2255- }
2260+ synchronized (conferenceStartTimeoutLock )
2261+ {
2262+ if (conferenceStartTimeout != null )
2263+ {
2264+ cancelConferenceStartTimeout ();
2265+ scheduleConferenceStartTimeout ();
2266+ }
2267+ }
2268+ }
22562269
2257- // in case of last participant leaving to join a breakout room, we want to skip destroy
2258- if (jicofoServices .getFocusManager ().hasBreakoutRooms (roomName ))
2270+ /**
2271+ * Schedules conference start timeout.
2272+ */
2273+ private void scheduleConferenceStartTimeout ()
2274+ {
2275+ synchronized (conferenceStartTimeoutLock )
2276+ {
2277+ cancelConferenceStartTimeout ();
2278+ conferenceStartTimeout = TaskPools .getScheduledPool ().schedule (
2279+ () ->
22592280 {
2260- logger .info ("Breakout rooms present, will not stop." );
2261- return ;
2262- }
2281+ if (includeInStatistics )
2282+ {
2283+ logger .info ("Expiring due to initial timeout." );
2284+ }
22632285
2264- stop ();
2265- },
2266- ConferenceConfig .config .getConferenceStartTimeout ().toMillis (),
2267- TimeUnit .MILLISECONDS );
2286+ // in case of last participant leaving to join a breakout room, we want to skip destroy
2287+ if (jicofoServices .getFocusManager ().hasBreakoutRooms (roomName ))
2288+ {
2289+ logger .info ("Breakout rooms present, will not stop." );
2290+ return ;
2291+ }
2292+
2293+ stop ();
2294+ },
2295+ ConferenceConfig .config .getConferenceStartTimeout ().toMillis (),
2296+ TimeUnit .MILLISECONDS );
2297+ }
22682298 }
22692299
22702300 /** Called when a new visitor has been added to the conference. */
0 commit comments