io.antmedia.shutdown.AMSShutdownManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ant-media-server Show documentation
Show all versions of ant-media-server Show documentation
Ant Media Server supports RTMP, RTSP, MP4, HLS, WebRTC, Adaptive Streaming, etc.
package io.antmedia.shutdown;
import java.util.ArrayList;
public class AMSShutdownManager {
private static AMSShutdownManager instance = new AMSShutdownManager();
private boolean isShuttingDown = false;
private ArrayList listeners = new ArrayList<>();
public static AMSShutdownManager getInstance() {
return instance;
}
public void subscribe(IShutdownListener listener) {
listeners.add(listener);
}
public void notifyShutdown() {
if(!isShuttingDown) {
isShuttingDown = true;
for (IShutdownListener listener : listeners) {
listener.serverShuttingdown();
}
}
}
}