📄 smspush.java
字号:
/**
* Created at Dec 2, 2008
*/
package com.jdev.app.db;
import com.jdev.net.connector.ConnectionFactory;
import com.jdev.net.event.Notifier;
import com.jdev.sms.soa.SMSWebService;
import com.jdev.util.Debug;
/**
* <p>Title: SmsPush</p>
* <p>Description: </p>
* @author Lawrence
* @version 1.0
*/
public class SmsPush implements Runnable {
private static Notifier notifier = Notifier.getNotifier();
private SmsQueueHelper smsDataHelper;
/**
*
*/
public SmsPush() {
smsDataHelper = new SmsQueueHelper(ConnectionFactory.CLIENT);
}
/* (non-Javadoc)
* @see java.lang.Runnable#run()
*/
public void run() {
while (!Thread.interrupted()) {
try {
Thread.sleep(1000);
String strOut = smsDataHelper.readSend();
// Debug.logVerbose(strOut);
// 发送短信
String[] s = strOut.split(",");
if(s.length == 3){
String[] callees = new String[]{s[0]};
String isReturn = "0";
int msgId = 136744;
strOut = s[1];
String ret = SMSWebService.sendMsg(strOut, callees, isReturn, msgId);
notifier.fireOnStatus(strOut, Integer.parseInt(ret));
// if(ret.equalsIgnoreCase("0"))
// notifier.fireOnStatus(strOut, 0);
// else
// notifier.fireOnStatus(strOut, 1);
}
} catch (Exception e) {
notifier.fireOnError("-->Error occured in SmsPush: "
+ e.getMessage());
continue;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -