private ActionEvent getScheduleSMSInfo()
{
Iterator<ScheduleSMS> it = this.context.getFetionStore().getScheduleSMSList().iterator();
int pageSize = 20;
ArrayList <ScheduleSMS> readyList = new ArrayList<ScheduleSMS>();
ActionEventFuture future = new ActionEventFuture();
ServerDialog dialog = this.context.getDialogFactory().getServerDialog();
//迭代所有的定时短信列表,并在每20个发起一次获取定时短信详细内容的请求
while(it.hasNext()){
ScheduleSMS sc = it.next();
readyList.add(sc);
if(readyList.size()==20){
future.clear();
dialog.getScheduleSMSInfo(readyList, future);
ActionEvent event = future.waitActionEventWithoutException();
if(event.getEventType()==ActionEventType.SUCCESS){
readyList.clear(); //成功继续下一次请求
}else{
return event; //失败返回这个错误事件
}
}
}
//迭代完了,可能仍有部分短信没有请求,检查下请求列表,如果不为空,则继续请求
if(readyList.size()>0){
future.clear();
dialog.getScheduleSMSInfo(readyList, future);
return future.waitActionEventWithoutException();
}else{
return new SuccessEvent(); //成功
}
}