如下一段程序,我怎么才能做到输入exit退出,输入别的没反应!!谢谢各位大大~
try
{
ConnectionDB.getConnection();
while(true)
{
System.out.println("正在启动服务...");
controller.start();
//State == 线程是否正常运行 getState -- 获得服务器的核心处理线程的状态
while (Thread.State.RUNNABLE != controller.getState())
{
}
System.out.println("服务启动完毕");
String command = reader.readLine();
if ("exit".equals(command))
{
controller.interrupt();
break;
}
else
{
continue;
}
}
} catch (Exception ex) {
System.out.println("main:" + ex);
}
System.out.println("退出");
System.exit(0);
}
try
{
ConnectionDB.getConnection();
while(true)
{
System.out.println("正在启动服务...");
controller.start();
//State == 线程是否正常运行 getState -- 获得服务器的核心处理线程的状态
while (Thread.State.RUNNABLE != controller.getState())
{
}
System.out.println("服务启动完毕");
String command = reader.readLine();
if ("exit".equals(command))
{
controller.interrupt();
break;
}
else
{
continue;
}
}
} catch (Exception ex) {
System.out.println("main:" + ex);
}
System.out.println("退出");
System.exit(0);
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货