All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.antmedia.shutdown.AMSShutdownManager Maven / Gradle / Ivy

Go to download

Ant Media Server supports RTMP, RTSP, MP4, HLS, WebRTC, Adaptive Streaming, etc.

There is a newer version: 2.10.0
Show newest version
package io.antmedia.shutdown;

import java.util.ArrayList;
import java.util.List;

public class AMSShutdownManager {
	private static AMSShutdownManager instance = new AMSShutdownManager();
	
	private boolean isShuttingDown = false;
	
	private ArrayList listeners = new ArrayList<>();

	public static AMSShutdownManager getInstance() {
		return instance;
	}
	
	//make a private constructor for singleton instance
	private AMSShutdownManager() {
	}
	
	public void subscribe(IShutdownListener listener) {
		getListeners().add(listener);
	}
	
	public void notifyShutdown() {
		if(!isShuttingDown) {
			isShuttingDown = true;
			for (IShutdownListener listener : getListeners()) {
				listener.serverShuttingdown();
			}
		}
	}

	public List getListeners() {
		return listeners;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy