|
|
|
package com.fr.start.server;
|
|
|
|
|
|
|
|
import com.fr.event.EventDispatcher;
|
|
|
|
import com.fr.module.ModuleContext;
|
|
|
|
import com.fr.plugin.listener.SpecialPluginEvent;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Created by juhaoyu on 2018/6/6.
|
|
|
|
*/
|
|
|
|
public abstract class FineEmbedServer {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 是否正在启动中
|
|
|
|
*/
|
|
|
|
private static volatile boolean onStarting = false;
|
|
|
|
|
|
|
|
public synchronized static void start() {
|
|
|
|
onStarting = true;
|
|
|
|
EventDispatcher.fire(SpecialPluginEvent.WITH_SERVER_AND_NOT_START_IN_REMOTE);
|
|
|
|
EventDispatcher.fire(EmbedServerEvent.BeforeStart);
|
|
|
|
ModuleContext.getModule(FineEmbedServerActivator.class).start();
|
|
|
|
onStarting = false;
|
|
|
|
EventDispatcher.fire(EmbedServerEvent.AfterStart);
|
|
|
|
}
|
|
|
|
|
|
|
|
public synchronized static void stop() {
|
|
|
|
|
|
|
|
EventDispatcher.fire(EmbedServerEvent.BeforeStop);
|
|
|
|
ModuleContext.getModule(FineEmbedServerActivator.class).stop();
|
|
|
|
EventDispatcher.fire(EmbedServerEvent.AfterStop);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean isRunning() {
|
|
|
|
|
|
|
|
return ModuleContext.getModule(FineEmbedServerActivator.class).isRunning();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean isOnStarting() {
|
|
|
|
return onStarting;
|
|
|
|
}
|
|
|
|
}
|