此篇文章仅做记录,不供参考!
/**
* 倒计时 s-e
*/
private Timertimer;
private TimerTasktimerTask;
private long distination_total =timer_unit *120;
private long timer_couting;
/**
* 轮询 s-e
*/
private TimerorderTimer;
private TimerTaskorderQueryTask;
private long queryTotal =timer_unit *120;
private long query_couting;
/**
* 计时开始
*/
private void startTimer() {
timer =new Timer();
timerTask =new MyComTimerTask();
timer.scheduleAtFixedRate(timerTask, 0, timer_unit);
orderTimer =new Timer();
orderQueryTask =new OrderComTask();
orderTimer.scheduleAtFixedRate(orderQueryTask,0,timer_unit*3);
}
有序Handler !
/**排队数组,针对多票情况,增删*/
private HashtablemTable =new Hashtable();
/**排队数组,针对多票情况,仅作缓存票根*/
private ListmTableCache =new ArrayList<>();
/**
* 过滤重复订单
* @return
*/
private boolean isContainOrderId(String orderId){
if (mTableCache.size() ==0){
return false;
}
for (int i =0; i
if (mTableCache.get(i).equals(orderId)){
return true;
}
}
return false;
}
/**
* 获取缓存订单
* @return
*/
private OrderQueryBean.ListBeangetCacheTicketBean(){
if (null ==mTable){
return null;
}
Iterator> iter =mTable.entrySet().iterator();
if (iter.hasNext()){
Map.Entry entry = (Map.Entry)iter.next();
String key = entry.getKey();
OrderQueryBean.ListBean value = entry.getValue();
mTable.remove(key);
return value;
}
return null;
}
网友评论