| | |
| | | |
| | | import com.dy.common.queue.Node; |
| | | import com.dy.common.mw.core.CoreTask; |
| | | import com.dy.aceMw.server.forTcp.TcpDownCommandCache; |
| | | import com.dy.aceMw.server.forTcp.TcpDownCommandCach; |
| | | import com.dy.aceMw.server.forTcp.TcpDownCommandObj; |
| | | import com.dy.aceMw.server.forTcp.TcpSessionCach; |
| | | |
| | |
| | | * 处理下行命令 |
| | | */ |
| | | public Integer dealDownCommand(Long now) { |
| | | Node first = TcpDownCommandCache.getFirstQueueNode() ; |
| | | if(first != null){ |
| | | Integer count = TcpDownCommandCache.size() ; |
| | | Node last = TcpDownCommandCache.getLastQueueNode() ; |
| | | this.doDealDownCommand(now, first, last); |
| | | return count ; |
| | | try{ |
| | | Node first = TcpDownCommandCach.getFirstQueueNode() ; |
| | | if(first != null){ |
| | | Integer count = TcpDownCommandCach.size() ; |
| | | Node last = TcpDownCommandCach.getLastQueueNode() ; |
| | | this.doDealDownCommand(now, first, last); |
| | | return count ; |
| | | } |
| | | }catch(Exception e){ |
| | | log.error(e); |
| | | } |
| | | return null ; |
| | | } |
| | |
| | | * 处理缓存的下行命令节点 |
| | | * @param now 当前时刻 |
| | | * @param first 第一个节点 |
| | | * @param last 最后一个节点 |
| | | * @param last 是后一个节点 |
| | | */ |
| | | private void doDealDownCommand1(Long now, Node first, Node last){ |
| | | private void doDealDownCommand(Long now, Node first, Node last){ |
| | | if(first != null){ |
| | | //在dealNode方法中,可能要把first从队列中移除,这时first.next为空,所以提前把first.next取出来 |
| | | Node next = first.next ; |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 处理缓存的下行命令节点 |
| | | * @param now 当前时刻 |
| | | * @param first 第一个节点 |
| | | * @param last 最后一个节点 |
| | | */ |
| | | private void doDealDownCommand(Long now, Node first, Node last){ |
| | | if(last != null){ |
| | | //在dealNode方法中,可能要把last从队列中移除,这时last.pre为空,所以提前把last.pre取出来 |
| | | Node pre = last.pre ; |
| | | dealNode(now, last) ; |
| | | if(first != null && first != last){ |
| | | doDealDownCommand(now, first, pre) ; |
| | | }else if(first != null && first == last){ |
| | | //停止 |
| | | }else if(first == null){ |
| | | //这种情况不会存在 |
| | | doDealDownCommand(now, null, pre) ; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 处理一个节点 |
| | |
| | | TcpDownCommandObj obj = (TcpDownCommandObj)node.obj ; |
| | | boolean removeNode = obj.dealSelf(now) ; |
| | | if(removeNode){ |
| | | TcpDownCommandCache.removeNode(node); |
| | | TcpDownCommandCach.removeNode(node); |
| | | } |
| | | } |
| | | |