private static Map <String,Long> UserOnline = new HashMap<String,Long> ();
我的服务中有以下静态的线程,功能是每分钟输出在线用户,登录的用户信息放在 UserOnline 中,应用服务删除后再部署的话,以下程序还在跑?不想重启服务器,怎么弄?
static {
Thread sessionThread = new Thread(
new Runnable(){
@SuppressWarnings("unchecked")
public void run()
{
try{
while(true){ Set UserList = CommonMethod.UserOnline.keySet();
logger.info("************************登陆用户列表***********************");
for(Iterator it = UserList.iterator();it.hasNext();){
String ip = (String)it.next();
logger.info("用户单位:"+((BzrjUser)CommonMethod.UserOnline.get(ip)).getProvice()+" IP:"+ip+" is on line");
}//add by wang
logger.info("***************************************************************");
}catch(Exception e){
e.printStackTrace();
}
}
}
);
sessionThread.setPriority(Thread.MIN_PRIORITY);
sessionThread.start();
}
我的服务中有以下静态的线程,功能是每分钟输出在线用户,登录的用户信息放在 UserOnline 中,应用服务删除后再部署的话,以下程序还在跑?不想重启服务器,怎么弄?
static {
Thread sessionThread = new Thread(
new Runnable(){
@SuppressWarnings("unchecked")
public void run()
{
try{
while(true){ Set UserList = CommonMethod.UserOnline.keySet();
logger.info("************************登陆用户列表***********************");
for(Iterator it = UserList.iterator();it.hasNext();){
String ip = (String)it.next();
logger.info("用户单位:"+((BzrjUser)CommonMethod.UserOnline.get(ip)).getProvice()+" IP:"+ip+" is on line");
}//add by wang
logger.info("***************************************************************");
}catch(Exception e){
e.printStackTrace();
}
}
}
);
sessionThread.setPriority(Thread.MIN_PRIORITY);
sessionThread.start();
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货