WAP PUSH后台源码,WAP PUSH后台源码
源代码在线查看: control.java
package com.sxit.wap.sys;
import com.sxit.wap.channel.*;
import com.sxit.wap.netstat.*;
import com.sxit.wap.sms.*;
import java.util.*;
public class control extends Thread{
public void run() {
try {
Collection coll = NetstatDao.queryAll();
Iterator it = coll.iterator();
ProcessCommand processCommand = new ProcessCommand();
while (it.hasNext()) {
NetstatModel ns = (NetstatModel) it.next();
String name = ns.getMachName();
String ip = ns.getMachIp().trim();
if (!processCommand.isPingOk(ip)) {
smsInterface sms = new smsInterface(); //短信发送
String msg = new String(name.getBytes(), "GB2312");
msg = msg + new String("网络连接已经中断".getBytes(), "GB2312");
sms.sendMessage("13309691000", msg);
}else{
System.out.println(name + "网络连接正常");
}
}
coll = ChannelDao.queryAll();
it = coll.iterator();
while (it.hasNext()) {
ChannelModel channel = (ChannelModel) it.next();
String name = channel.getChannelName();
String url = channel.getChannelUrl();
url = url.indexOf("http://")>0?url:"http://"+url;
if(processCommand.isServerOk(url).indexOf("服务正常") smsInterface sms = new smsInterface(); //短信发送
String msg = new String(name.getBytes(),"GB2312");
msg = msg + new String(processCommand.isServerOk(url).getBytes(),"GB2312");
sms.sendMessage("13309691000", msg);
}else{
System.out.println(name + "服务正常");
}
}
}catch (Exception ex) {
ex.printStackTrace();
}
}
public static void main(String[] args) {
}
}