我有形式的消息構造方法:發送SMS
public static String constructMsg(CustomerInfo customer) {
... snipped
String msg = String.format("Snipped code encapsulated by customer object");
return msg;
}
的API鏈接是:
http://xxx.xxx.xx.xx:8080/bulksms?username=xxxxxxx &密碼= XXXX &類型= 0 & DLR = 1 &目的地= 10digitno & source = xxxxxx & message = xxxxx
在我的主要方法中,我有:(s):
List<CustomerInfo> customer = dao.getSmsDetails(userDate);
theLogger.info("Total No : " + customer.size());
if (!customer.isEmpty()) {
for (CustomerInfo cust : customer) {
String message = constructMsg(cust);
// Add link and '?' and query string
// use URLConnection's connect method
}
}
所以我使用的是URLConnection的connect
方法。該API沒有任何文檔。有什麼方法可以檢查回覆嗎?
我的另一個問題是,我被建議使用ThreadPoolExecutor。我會如何在這裏使用它?
這沒有任何意義。 'constructMsg('需要一個它不使用的參數。爲什麼? – acdcjunior
已編輯的代碼我只添加了重要的位 –