private void maybeDoShutdown() { if (shutdownInProgress && conferences.size() == 0) { logger.info("Focus is shutting down NOW"); ShutdownService shutdownService = ServiceUtils.getService(FocusBundleActivator.bundleContext, ShutdownService.class); shutdownService.beginShutdown(); } }
/** {@inheritDoc} */ @Override public synchronized void conferenceEnded(JitsiMeetConference conference) { String roomName = conference.getRoomName(); conferences.remove(roomName); logger.info( "Disposed conference for room: " + roomName + " conference count: " + conferences.size()); if (focusAllocListener != null) { focusAllocListener.onFocusDestroyed(roomName); } // Send focus destroyed event FocusBundleActivator.getEventAdmin() .sendEvent(EventFactory.focusDestroyed(conference.getId(), conference.getRoomName())); maybeDoShutdown(); }
/** * Makes sure that conference is allocated for given <tt>room</tt>. * * @param room name of the MUC room of Jitsi Meet conference. * @param properties configuration properties, see {@link JitsiMeetConfig} for the list of valid * properties. * @throws Exception if any error occurs. */ private void createConference(String room, Map<String, String> properties) throws Exception { JitsiMeetConfig config = new JitsiMeetConfig(properties); JitsiMeetConference conference = new JitsiMeetConference(room, focusUserName, protocolProviderHandler, this, config); conferences.put(room, conference); StringBuilder options = new StringBuilder(); for (Map.Entry<String, String> option : properties.entrySet()) { options.append("\n ").append(option.getKey()).append(": ").append(option.getValue()); } logger.info( "Created new focus for " + room + "@" + focusUserDomain + " conferences count: " + conferences.size() + " options:" + options.toString()); // Send focus created event EventAdmin eventAdmin = FocusBundleActivator.getEventAdmin(); if (eventAdmin != null) { eventAdmin.sendEvent(EventFactory.focusCreated(conference.getId(), conference.getRoomName())); } try { conference.start(); } catch (Exception e) { logger.info("Exception while trying to start the conference", e); conference.stop(); throw e; } }
/** Returns the number of currently allocated focus instances. */ public int getConferenceCount() { return conferences.size(); }