Beispiel #1
0
 /**
  * 添加日志服务
  *
  * @param appender
  */
 public void addAppender(BaseAppender appender)
 {
     lock (m_appenders) {
         m_appenders.put(appender.m_id, appender);
         addAppenderThread(appender);
     }
 }
Beispiel #2
0
 /**
  * 移除日志服务
  *
  * @param appender
  */
 public void removeAppender(BaseAppender appender)
 {
     lock (m_appenders) {
         m_appenders.remove(appender.m_id);
         removeAppenderThread(appender);
     }
 }
Beispiel #3
0
 /**
  * 移除AppenderThread
  *
  * @param appender
  */
 private void removeAppenderThread(BaseAppender appender)
 {
     m_dataInfos.remove(appender.m_id);
     try {
         Thread t = m_threads.get(appender.m_id);
         t.Abort();
         t = null;
         m_threads.remove(appender.m_id);
     } catch (Exception e) {
     }
 }
Beispiel #4
0
        /**
         * 添加AppenderThread
         *
         * @param appender
         */
        private void addAppenderThread(BaseAppender appender)
        {
            m_dataInfos.put(appender.m_id, new ArrayList <LogWorkDataInfo>());
            Object[] parameters = new Object[2];
            parameters[0] = this;
            parameters[1] = appender.m_id;
            OnWork onWork = new OnWork(appender.m_id, m_messages, m_dataInfos, m_stopDatas);
            Thread thread = new Thread(new ThreadStart(onWork.run));

            thread.Start();
            m_threads.put(appender.m_id, thread);
        }