我有形式的消息构造方法:发送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
已编辑的代码我只添加了重要的位 –