| package com.dy.rtuMw.server.rtuData; | 
|   | 
| import com.dy.common.queue.NodeObj; | 
| import com.dy.common.threadPool.ThreadPool; | 
| import com.dy.common.threadPool.TreadPoolFactory; | 
| import org.apache.logging.log4j.LogManager; | 
| import org.apache.logging.log4j.Logger; | 
|   | 
| public class RtuDataNode implements NodeObj { | 
|   | 
|     private static final Logger log = LogManager.getLogger(RtuDataNode.class.getName()); | 
|   | 
|     public Object obj ;//数据 | 
|   | 
|     public RtuDataNode(Object obj){ | 
|         this.obj = obj ; | 
|     } | 
|     /** | 
|      * 自己处理自己 | 
|      * @return | 
|      */ | 
|     public boolean dealSelf(){ | 
|         try { | 
|             ThreadPool.Pool pool = TreadPoolFactory.getThreadPoolLong() ; | 
|             pool.putJob(new ThreadPool.Job() { | 
|                 public void execute() { | 
|                     if(obj != null){ | 
|                         TaskSurpport task = null ; | 
|                         try{ | 
|                             task = TaskPool.popTask() ; | 
|                             if(task != null){ | 
|                                 task.execute(obj); | 
|                             }else{ | 
|                                 log.error("未得到RTU主动上报数据处理任务!"); | 
|                             } | 
|                         }catch(Exception e){ | 
|                             log.error("上行数据任务池处理数据时发生异常", e); | 
|                         }finally { | 
|                             if(task != null){ | 
|                                 TaskPool.freeAndCleanTask(task); | 
|                             } | 
|                         } | 
|                     } | 
|                 } | 
|                 @Override | 
|                 public void destroy(){ | 
|                 } | 
|                 @Override | 
|                 public boolean isDestroy(){ | 
|                     return false ; | 
|                 } | 
|   | 
|             }); | 
|         } catch (Exception e) { | 
|             log.error("在RtuDataNode内发生异常", e); | 
|         } | 
|         return true ; | 
|     } | 
|   | 
|   | 
| } |