Skip to content
Snippets Groups Projects
Commit 91ffaeb2 authored by Richard Alam's avatar Richard Alam
Browse files

- hook into shutdown event so we can kick all users from the conference

parent 48d7e008
No related branches found
No related tags found
No related merge requests found
......@@ -28,8 +28,12 @@ import org.red5.logging.Red5LoggerFactory;
import org.red5.server.adapter.IApplication;
import org.red5.server.adapter.MultiThreadedApplicationAdapter;
import org.red5.server.api.IConnection;
import org.red5.server.api.IContext;
import org.red5.server.api.IScope;
import org.slf4j.Logger;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.support.AbstractApplicationContext;
public class BigBlueButtonApplication extends MultiThreadedApplicationAdapter {
......@@ -38,12 +42,17 @@ public class BigBlueButtonApplication extends MultiThreadedApplicationAdapter {
private static final String APP = "BigBlueButtonApplication";
private ParticipantsApplication participantsApplication;
private RecorderApplication recorderApplication;
private AbstractApplicationContext appCtx;
private String version;
@Override
public boolean appStart(IScope app) {
log.debug("Starting BigBlueButton version {}", version);
IContext context = app.getContext();
appCtx = (AbstractApplicationContext) context.getApplicationContext();
appCtx.addApplicationListener(new ShutdownHookListener());
appCtx.registerShutdownHook();
return super.appStart(app);
}
......@@ -157,4 +166,16 @@ public class BigBlueButtonApplication extends MultiThreadedApplicationAdapter {
private BigBlueButtonSession getBbbSession() {
return (BigBlueButtonSession) Red5.getConnectionLocal().getAttribute(Constants.SESSION);
}
private class ShutdownHookListener implements ApplicationListener<ApplicationEvent> {
@Override
public void onApplicationEvent(ApplicationEvent event) {
if (event instanceof org.springframework.context.event.ContextStoppedEvent) {
log.info("Received shutdown event. Destroying all rooms.");
participantsApplication.destroyAllRooms();
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment