Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

meetings now are removed after the end

  • Loading branch information...
commit 415b1ac6db27067a167c9bff7bcd46e481ed5695 1 parent 2b45b1a
Jeremy Thomerson authored
7 src/main/java/com/genericconf/bbbgateway/TimerSettings.java
@@ -35,14 +35,15 @@ private boolean isDev() {
35 35 // NOTE: these will only be called before app is started, resulting in non-dev values always
36 36 public int getSecondsBetweenMeetingUpdateRuns() { return isDev() ? 15 : 45; }
37 37 public int getSecondsBeforeFirstMeetingUpdateRun() { return isDev() ? 15 : 45; }
  38 + public int getSecondsBeforeMeetingIsRemovedAfterEnding() { return 15 * 60; } /* 15 minutes */
38 39
39 40 // ManageMeeting page:
40   - public int getSecondsBetweenManageMeetingPagePolls() { return isDev() ? 15 : 30; }
  41 + public int getSecondsBetweenManageMeetingPagePolls() { return isDev() ? 5 : 20; }
41 42
42 43 // WaitingRoom page:
43   - public int getSecondsBetweenWaitingRoomPagePolls() { return isDev() ? 10 : 90; }
  44 + public int getSecondsBetweenWaitingRoomPagePolls() { return isDev() ? 5 : 20; }
44 45 public int getSecondsBeforeFirstWaitingRoomPagePoll() { return isDev() ? 2 : 2; }
45   - public int getSecondsWithNoPingThatIndicatesTimeOut() { return isDev() ? 30 : 210; }
  46 + public int getSecondsWithNoPingThatIndicatesTimeOut() { return isDev() ? 15 : 90; }
46 47
47 48 // HomePage :
48 49 public int getSecondsBetweenHomePagePolls() { return getSecondsBetweenWaitingRoomPagePolls(); }
17 src/main/java/com/genericconf/bbbgateway/domain/Meeting.java
@@ -23,10 +23,15 @@
23 23 import java.util.Map;
24 24
25 25 import org.apache.commons.lang.RandomStringUtils;
  26 +import org.slf4j.Logger;
  27 +import org.slf4j.LoggerFactory;
  28 +
  29 +import com.genericconf.bbbgateway.TimerSettings;
26 30
27 31 public class Meeting extends Entity {
28 32
29 33 private static final long serialVersionUID = 1L;
  34 + private static final Logger logger = LoggerFactory.getLogger(Meeting.class);
30 35
31 36 private Server server;
32 37
@@ -290,4 +295,16 @@ public void removeAttendee(Attendee att) {
290 295 waiters.remove(att.getName());
291 296 }
292 297
  298 + public boolean isTimedOut() {
  299 + if (startTime != null && endTime != null) {
  300 + long ended = endTime.getTime();
  301 + final int elapsed = (int) ((System.currentTimeMillis() - ended) / 1000);
  302 + final boolean timedOut = elapsed > TimerSettings.INSTANCE.getSecondsBeforeMeetingIsRemovedAfterEnding();
  303 + logger.debug("meeting: {}, ended: {}, elapsed: {}, threshold: {}, timed out: {}", new Object[] { name, ended, elapsed, TimerSettings.INSTANCE.getSecondsBeforeMeetingIsRemovedAfterEnding(), timedOut });
  304 + return timedOut;
  305 + }
  306 + logger.debug("meeting not timed out because it hasn't started and ended");
  307 + return false;
  308 + }
  309 +
293 310 }
1  src/main/java/com/genericconf/bbbgateway/services/BigBlueButtonApiService.java
@@ -69,6 +69,7 @@ boolean doExecute() throws Exception {
69 69 Date end = (Date) xml.get("endTime");
70 70 boolean running = (Boolean) xml.get("running");
71 71 meeting.setStartTime(start);
  72 + meeting.setEndTime(end);
72 73 logger.info("meeting [{}] start: {}; end: {}; running: {}", new Object[] { meeting.getMeetingID(), start, end, running });
73 74
74 75 List<Attendee> atts = (List<Attendee>) xml.get("attendees");
15 src/main/java/com/genericconf/bbbgateway/services/MeetingService.java
@@ -49,8 +49,20 @@ public MeetingService() {
49 49 @Override
50 50 public void run() {
51 51 logger.info("update meetings timer task running");
52   - for (Meeting meeting : meetings.values()) {
  52 + Set<Meeting> toRemove = new HashSet<Meeting>();
  53 + for (Meeting meeting : new HashSet<Meeting>(meetings.values())) {
53 54 tryToUpdateMeeting(meeting);
  55 + // now allow new ones to join if some have dropped off:
  56 + bulkAllowAttendees(meeting);
  57 + if (meeting.isTimedOut()) {
  58 + toRemove.add(meeting);
  59 + }
  60 + }
  61 + logger.info("meetings to remove: " + toRemove);
  62 + synchronized(meetings) {
  63 + for (Meeting rem : toRemove) {
  64 + meetings.remove(rem.getMeetingID());
  65 + }
54 66 }
55 67 }
56 68 };
@@ -72,6 +84,7 @@ public void bulkAllowAttendees(Meeting meeting) {
72 84 Collections.sort(waiters);
73 85 waiters = waiters.subList(0, Math.min(waiters.size(), allowIn));
74 86 for (Attendee att : waiters) {
  87 + logger.debug("allowing {} to join", new Object[] { att });
75 88 att.setAllowedToJoin(true);
76 89 }
77 90 }
1  src/main/java/com/genericconf/bbbgateway/web/pages/HomePage.java
@@ -22,7 +22,6 @@
22 22 import org.apache.wicket.PageParameters;
23 23 import org.apache.wicket.ajax.AbstractAjaxTimerBehavior;
24 24 import org.apache.wicket.ajax.AjaxRequestTarget;
25   -import org.apache.wicket.ajax.AjaxSelfUpdatingTimerBehavior;
26 25 import org.apache.wicket.ajax.markup.html.AjaxLink;
27 26 import org.apache.wicket.behavior.SimpleAttributeModifier;
28 27 import org.apache.wicket.markup.html.WebMarkupContainer;
9 src/main/java/com/genericconf/bbbgateway/web/pages/ManageMeeting.java
@@ -62,14 +62,19 @@ public ManageMeeting(PageParameters params) {
62 62 logger.info("meeting ID: " + meetingID + "; check: " + check + "; okay: " + okay);
63 63 if (!okay) {
64 64 getSession().error("You are not authorized to manage that meeting");
65   - throw new RestartResponseAtInterceptPageException(HomePage.class);
  65 + throw new RestartResponseAtInterceptPageException(getApplication().getHomePage());
66 66 }
67 67 IModel<Meeting> model = new LoadableDetachableModel<Meeting>() {
68 68 private static final long serialVersionUID = 1L;
69 69
70 70 @Override
71 71 protected Meeting load() {
72   - return meetingService.findByMeetingID(meetingID);
  72 + final Meeting mtg = meetingService.findByMeetingID(meetingID);
  73 + if (mtg == null) {
  74 + getSession().error("That meeting no longer exists");
  75 + throw new RestartResponseAtInterceptPageException(getApplication().getHomePage());
  76 + }
  77 + return mtg;
73 78 }
74 79 };
75 80 setDefaultModel(new CompoundPropertyModel<Meeting>(model));

0 comments on commit 415b1ac

Please sign in to comment.
Something went wrong with that request. Please try again.