本文整理汇总了Java中cn.nukkit.utils.ServerKiller类的典型用法代码示例。如果您正苦于以下问题:Java ServerKiller类的具体用法?Java ServerKiller怎么用?Java ServerKiller使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServerKiller类属于cn.nukkit.utils包,在下文中一共展示了ServerKiller类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: shutdown
import cn.nukkit.utils.ServerKiller; //导入依赖的package包/类
/**
* サーバーを終了させます。
* @return void
*/
public void shutdown() {
if (this.isRunning) {
ServerKiller killer = new ServerKiller(90);
killer.start();
}
this.isRunning = false;
}
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:12,代码来源:Server.java
示例2: main
import cn.nukkit.utils.ServerKiller; //导入依赖的package包/类
public static void main(String[] args) {
if(!(JAVA_VERSION.startsWith("1.8"))){
System.out.println("[CRITICAL] This program runs on JRE(JRE) 1.8");
System.out.println("[CRITICAL] You must use JRE(JDK) 1.8.");
System.out.println("[CRITICAL] Java version: " + JAVA_VERSION);
System.exit(0);
}
//Shorter title for windows 8/2012
String osName = System.getProperty("os.name").toLowerCase();
if (osName.contains("windows")) {
if (osName.contains("windows 8") || osName.contains("2012")) {
shortTitle = true;
}
}
//启动参数
for (String arg : args) {
switch (arg) {
case "disable-ansi":
ANSI = false;
break;
}
}
MainLogger logger = new MainLogger(DATA_PATH + "server.log");
System.out.println("Minecraft用 Jupiterサーバーを開始しています。");
jobs.add(new Callable<Server>(){
@Override
public Server call() throws Exception {
return new Server(logger, PATH, DATA_PATH, PLUGIN_PATH);
}
});
try {
threadpool.invokeAll(jobs);
threadpool.shutdown();
if(threadpool.awaitTermination(1L,TimeUnit.MINUTES)){// 1 minutes
System.out.println("サーバーを停止しています...");
logger.info("スレッドが停止しました。");
for (Thread thread : java.lang.Thread.getAllStackTraces().keySet()) {
if (!(thread instanceof InterruptibleThread)) {
continue;
}
logger.debug("Stopping " + thread.getClass().getSimpleName() + " thread");
if (thread.isAlive()) {
thread.interrupt();
}
}
ServerKiller killer = new ServerKiller(8);
killer.start();
logger.shutdown();
logger.interrupt();
CommandReader.getInstance().removePromptLine();
System.out.println("サーバーが停止しました。");
System.exit(0);
}else{
System.out.println("サーバーの停止に失敗しました。");
}
} catch (InterruptedException e) {
e.printStackTrace();
threadpool.shutdown();
}
}
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:76,代码来源:Nukkit.java
示例3: main
import cn.nukkit.utils.ServerKiller; //导入依赖的package包/类
public static void main(String[] args) {
//Shorter title for windows 8/2012
String osName = System.getProperty("os.name").toLowerCase();
if (osName.contains("windows")) {
if (osName.contains("windows 8") || osName.contains("2012")) {
shortTitle = true;
}
}
//启动参数
for (String arg : args) {
switch (arg) {
case "disable-ansi":
ANSI = false;
break;
}
}
MainLogger logger = new MainLogger(DATA_PATH + "server.log");
try {
if (ANSI) {
System.out.print((char) 0x1b + "]0;Starting Nukkit Server For Minecraft: PE" + (char) 0x07);
}
new Server(logger, PATH, DATA_PATH, PLUGIN_PATH);
} catch (Exception e) {
logger.logException(e);
}
if (ANSI) {
System.out.print((char) 0x1b + "]0;Stopping Server..." + (char) 0x07);
}
logger.info("Stopping other threads");
for (Thread thread : java.lang.Thread.getAllStackTraces().keySet()) {
if (!(thread instanceof InterruptibleThread)) {
continue;
}
logger.debug("Stopping " + thread.getClass().getSimpleName() + " thread");
if (thread.isAlive()) {
thread.interrupt();
}
}
ServerKiller killer = new ServerKiller(8);
killer.start();
logger.shutdown();
logger.interrupt();
CommandReader.getInstance().removePromptLine();
if (ANSI) {
System.out.print((char) 0x1b + "]0;Server Stopped" + (char) 0x07);
}
System.exit(0);
}
开发者ID:FrontierDevs,项目名称:Jenisys3,代码行数:58,代码来源:Nukkit.java
示例4: main
import cn.nukkit.utils.ServerKiller; //导入依赖的package包/类
public static void main(String[] args) {
//Shorter title for windows 8/2012
String osName = System.getProperty("os.name").toLowerCase();
if (osName.contains("windows")) {
if (osName.contains("windows 8") || osName.contains("2012")) {
shortTitle = true;
}
}
//启动参数
for (String arg : args) {
switch (arg) {
case "disable-ansi":
ANSI = false;
break;
}
}
MainLogger logger = new MainLogger(DATA_PATH + "server.log");
try {
if (ANSI) {
System.out.print((char) 0x1b + "]0;Starting CoreX Server For Minecraft: PE" + (char) 0x07);
}
new Server(logger, PATH, DATA_PATH, PLUGIN_PATH);
} catch (Exception e) {
logger.logException(e);
}
if (ANSI) {
System.out.print((char) 0x1b + "]0;Stopping Server..." + (char) 0x07);
}
logger.info("Stopping other threads");
for (Thread thread : java.lang.Thread.getAllStackTraces().keySet()) {
if (!(thread instanceof InterruptibleThread)) {
continue;
}
logger.debug("Stopping " + thread.getClass().getSimpleName() + " thread");
if (thread.isAlive()) {
thread.interrupt();
}
}
ServerKiller killer = new ServerKiller(8);
killer.start();
logger.shutdown();
logger.interrupt();
CommandReader.getInstance().removePromptLine();
if (ANSI) {
System.out.print((char) 0x1b + "]0;Server Stopped" + (char) 0x07);
}
System.exit(0);
}
开发者ID:CoreXDevelopment,项目名称:CoreX,代码行数:58,代码来源:Nukkit.java
示例5: main
import cn.nukkit.utils.ServerKiller; //导入依赖的package包/类
public static void main(String[] args) {
//Shorter title for windows 8/2012
String osName = System.getProperty("os.name").toLowerCase();
if (osName.contains("windows")) {
if (osName.contains("windows 8") || osName.contains("2012")) {
shortTitle = true;
}
}
//启动参数
for (String arg : args) {
switch (arg) {
case "disable-ansi":
ANSI = false;
break;
}
}
MainLogger logger = new MainLogger(DATA_PATH + "server.log");
try {
if (ANSI) {
System.out.print((char) 0x1b + "]0;Starting Nukkit Server For Minecraft: PE" + (char) 0x07);
}
Server server = new Server(logger, PATH, DATA_PATH, PLUGIN_PATH);
} catch (Exception e) {
logger.logException(e);
}
if (ANSI) {
System.out.print((char) 0x1b + "]0;Stopping Server..." + (char) 0x07);
}
logger.info("Stopping other threads");
for (Thread thread : java.lang.Thread.getAllStackTraces().keySet()) {
if (!(thread instanceof InterruptibleThread)) {
continue;
}
logger.debug("Stopping " + thread.getClass().getSimpleName() + " thread");
if (thread.isAlive()) {
thread.interrupt();
}
}
ServerKiller killer = new ServerKiller(8);
killer.start();
logger.shutdown();
logger.interrupt();
CommandReader.getInstance().removePromptLine();
if (ANSI) {
System.out.print((char) 0x1b + "]0;Server Stopped" + (char) 0x07);
}
System.exit(0);
}
开发者ID:Creeperface01,项目名称:NukkitGT,代码行数:58,代码来源:Nukkit.java
示例6: main
import cn.nukkit.utils.ServerKiller; //导入依赖的package包/类
public static void main(String[] args) {
//Shorter title for windows 8/2012
String osName = System.getProperty("os.name").toLowerCase();
if (osName.contains("windows")) {
if (osName.contains("windows 8") || osName.contains("2012")) {
shortTitle = true;
}
}
//启动参数
for (String arg : args) {
switch (arg) {
case "disable-ansi":
ANSI = false;
break;
}
}
MainLogger logger = new MainLogger(DATA_PATH + "server.log");
try {
if (ANSI) {
System.out.print((char) 0x1b + "]0;Starting Apollo Server For Minecraft: PE" + (char) 0x07);
}
new Server(logger, PATH, DATA_PATH, PLUGIN_PATH);
} catch (Exception e) {
logger.logException(e);
}
if (ANSI) {
System.out.print((char) 0x1b + "]0;Stopping Server..." + (char) 0x07);
}
logger.info("Stopping other threads");
for (Thread thread : java.lang.Thread.getAllStackTraces().keySet()) {
if (!(thread instanceof InterruptibleThread)) {
continue;
}
logger.debug("Stopping " + thread.getClass().getSimpleName() + " thread");
if (thread.isAlive()) {
thread.interrupt();
}
}
ServerKiller killer = new ServerKiller(8);
killer.start();
logger.shutdown();
logger.interrupt();
CommandReader.getInstance().removePromptLine();
if (ANSI) {
System.out.print((char) 0x1b + "]0;Server Stopped" + (char) 0x07);
}
System.exit(0);
}
开发者ID:NycuRO,项目名称:Apollo-OLD,代码行数:58,代码来源:Nukkit.java
注:本文中的cn.nukkit.utils.ServerKiller类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论