本文整理汇总了Java中co.aikar.timings.Timings.stopServer方法的典型用法代码示例。如果您正苦于以下问题:Java Timings.stopServer方法的具体用法?Java Timings.stopServer怎么用?Java Timings.stopServer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类co.aikar.timings.Timings
的用法示例。
在下文中一共展示了Timings.stopServer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shutdown
import co.aikar.timings.Timings; //导入方法依赖的package包/类
public void shutdown() {
logger.info(lang.get(Lang.SHUTTING_DOWN));
debug = false;
this.shuttingDown = true;
network.shutdown();
try {
Thread.sleep(2000); // Wait for all clients disconnected
} catch (Exception ex) {
System.out.println("Exception while shutting down!");
ex.printStackTrace();
}
Timings.stopServer();
System.out.println("Goodbye!");
System.exit(0);
}
示例2: forceShutdown
import co.aikar.timings.Timings; //导入方法依赖的package包/类
public void forceShutdown() {
if (this.hasStopped) {
return;
}
try {
if (!this.isRunning) {
//todo sendUsage
}
// clean shutdown of console thread asap
this.console.shutdown();
this.hasStopped = true;
this.shutdown();
if (this.rcon != null) {
this.rcon.close();
}
this.getLogger().debug("Disabling all plugins");
this.pluginManager.disablePlugins();
for (Player player : new ArrayList<>(this.players.values())) {
player.close(player.getLeaveMessage(), (String) this.getConfig("settings.shutdown-message", "Server closed"));
}
this.getLogger().debug("Unloading all levels");
for (Level level : new ArrayList<>(this.getLevels().values())) {
this.unloadLevel(level, true);
}
this.getLogger().debug("Removing event handlers");
HandlerList.unregisterAll();
this.getLogger().debug("Stopping all tasks");
this.scheduler.cancelAllTasks();
this.scheduler.mainThreadHeartbeat(Integer.MAX_VALUE);
this.getLogger().debug("Closing console");
this.console.interrupt();
this.getLogger().debug("Stopping network interfaces");
for (SourceInterface interfaz : this.network.getInterfaces()) {
interfaz.shutdown();
this.network.unregisterInterface(interfaz);
}
this.getLogger().debug("Disabling timings");
Timings.stopServer();
//todo other things
} catch (Exception e) {
this.logger.logException(e); //todo remove this?
this.logger.emergency("Exception happened while shutting down, exit the process");
System.exit(1);
}
}