<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      Spring中構造器、init-method、@PostConstruct、afterPropertiesSet孰先孰后,自動注入發生時間以及單例多例的區別、SSH線程安全問題

       

      引用: http://www.rzrgm.cn/qlqwjy/p/9417034.html

        首先明白,spring的IOC功能需要是利用反射原理,反射獲取類的無參構造方法創建對象,如果一個類沒有無參的構造方法spring是不會創建對象的。在這里需要提醒一下,如果我們在class中沒有顯示的聲明構造方法,默認會生成一個無參構造方法,但是當我們顯示的聲明一個有參構造方法的時候,JVM不會幫我們生成無參構造方法,所以我們聲明一個帶參數的構造方法也需要聲明一個無參構造方法。(題外話:如果父類聲明一個有參構造方法,子類需要在構造方法第一行顯示的調用父類構造方法,因為子類的對象也是父類的對象,所以在創建子類對象的同時也會創建父類的對象,如果父類有默認的無參構造函數,JVM會調用無參構造函數,但是有了有參的就需要我們在子類的構造函數中調用父類的有參構造函數)

       

       1.Person類只有一個有參構造方法,報錯如下:

      No default constructor found; nested exception is java.lang.NoSuchMethodException: zd.dms.job.ebuy.Person.<init>()

      2.大體知道有三種生命周期回調方法去參與到spring的生命周期,查閱了一下如下:(創建和銷毀的執行順序也是下面順序)

      • 在指定方法上加上@PostConstruct 或@PreDestroy注解來制定該方法是在初始化之后還是銷毀之前調用。
      • 通過實現 InitializingBean/DisposableBean 接口來定制初始化之后/銷毀之前的操作方法;     
      • 通過 <bean> 元素的 init-method/destroy-method屬性指定初始化之后 /銷毀之前調用的操作方法;  

      3.測試spring的順序與注入的順序與單例多例的問題

      1.Person.java

      復制代碼
      package zd.dms.job.ebuy;
      
      import javax.annotation.PostConstruct;
      import javax.annotation.PreDestroy;
      
      import org.springframework.beans.factory.DisposableBean;
      import org.springframework.beans.factory.InitializingBean;
      import org.springframework.beans.factory.annotation.Autowired;
      
      import zd.dms.dao.ebuy.GroupDao;
      
      public class Person implements InitializingBean,DisposableBean{
          private String name;
          
          @Autowired
          private GroupDao groupDao;
      
          public Person() {
              System.out.println("---------------實例化一個Person對象----------");
              System.out.println("---------------groupDao is -----------"+groupDao);
          }
      
          public void init() {
              System.out.println("------------這是xml的init方法----------....");
              System.out.println("---------------groupDao is -----------"+groupDao);
          }
      
          public void destory() {
              System.out.println("---------------這是xml的destroy方法....");
              System.out.println("---------------groupDao is -----------"+groupDao);
          }
          
          @PostConstruct
          public void init2() {
              System.out.println("------------這是@PostConstruct的init方法----------....");
              System.out.println("---------------groupDao is -----------"+groupDao);
          }
          
          @PreDestroy
          public void destory2() {
              System.out.println("---------------這是@PreDestroy的destroy方法....");
              System.out.println("---------------groupDao is -----------"+groupDao);
          }
      
          @Override
          public void destroy() throws Exception {
              System.out.println("-----------這是DisposableBean的destroy方法....");
              System.out.println("---------------groupDao is -----------"+groupDao);
          }
      
          @Override
          public void afterPropertiesSet() throws Exception {
              System.out.println("-------這是InitializingBean的afterPropertiesSet方法....");
              System.out.println("---------------groupDao is -----------"+groupDao);
          }
      }
      復制代碼

       

       -----------------------單例模式的xml配置以及結果---------------------------------------:

      配置:

          <bean id="person" class="zd.dms.job.ebuy.Person" autowire="byType" destroy-method="destory" init-method="init"></bean> 

       

      測試:將Person類注入到Action我們訪問Action

      復制代碼
      @Namespace("/qlqTest")
      @SuppressWarnings("all")
      public class TestAction extends DMSActionSupport {
      
          @Autowired
          private Person person;
          /**
           * 
           */
          private static final long serialVersionUID = -8934360924125349297L;
      
          @Autowired
          private GroupAndUserService groupAndUserService;
      
          private Map resultMap;
      
          @Action("test")
          public String testAction() {
              person.getClass();
              return "js";
          }
      }
      復制代碼

       

      當我們第一次訪問該Action會創建Person對象,打印結果如下:

      復制代碼
      - ---------------實例化一個Person對象----------
      ---------------groupDao is -----------null
      ------------這是@PostConstruct的init方法----------....
      ---------------groupDao is -----------zd.dms.dao.ebuy.GroupDaoImpl@435598e3
      -------這是InitializingBean的afterPropertiesSet方法....
      ---------------groupDao is -----------zd.dms.dao.ebuy.GroupDaoImpl@435598e3
      ------------這是xml的init方法----------....
      ---------------groupDao is -----------zd.dms.dao.ebuy.GroupDaoImpl@435598e3
      復制代碼

       

      證明對象創建的順序:

          構造器-->自動注入-->@PostConstrut-->InitializingBean-->xml中配置init方法    

       

      再次調用不會打印,證明默認是單例的  singleton,也就是無論我們訪問多少次Action,Spring容器中只有一個這個Person實例對象。

       

      銷毀的時候的結果:

      復制代碼
      ---------------這是@PreDestroy的destroy方法....
      ---------------groupDao is -----------zd.dms.dao.ebuy.GroupDaoImpl@435598e3
      -----------這是DisposableBean的destroy方法....
      ---------------groupDao is -----------zd.dms.dao.ebuy.GroupDaoImpl@435598e3
      ---------------這是xml的destroy方法....
      ---------------groupDao is -----------zd.dms.dao.ebuy.GroupDaoImpl@435598e3
      復制代碼

       

      所以銷毀順序為:

        @PreDestroy--DisposableBean-->xml中destroy-method方法

       

       -----------------------多例模式的xml配置以及結果---------------------------------------:

      配置:

      <bean id="person" class="zd.dms.job.ebuy.Person" autowire="byType" destroy-method="destory" init-method="init" scope="prototype"></bean>

       

      我們多次訪問Action,所以Action會多次調用Person對象,發現會多次創建Person對象,也就是請求一次會創建一個對象,也就是多例:

       

       

       至于到底是該使用單例還是多例,這就需要我們平時的業務需求了,springMvc就是單例的,struts2默認就是多例的。我們也可以使用注解配置單例和多例,如下:

       

       

       

      ---------------------為了理解上面的單例多例的例子,繼續測試---------------------

      1.單例多例的對象創建問題

      1.測試 action-service-dao是多-單-單 模式

      Action:

      復制代碼
      package cn.qlq.action;
      
      import java.util.HashMap;
      import java.util.Map;
      
      import org.apache.struts2.convention.annotation.Action;
      import org.apache.struts2.convention.annotation.Namespace;
      import org.apache.struts2.convention.annotation.ParentPackage;
      import org.apache.struts2.convention.annotation.Result;
      import org.apache.struts2.convention.annotation.Results;
      import org.springframework.beans.factory.annotation.Autowired;
      import org.springframework.stereotype.Controller;
      
      import com.opensymphony.xwork2.ActionSupport;
      
      import cn.qlq.service.UserService;
      
      @Namespace("/")
      @ParentPackage("default")
      @Controller("firstAction")
      @Results({ @Result(name = "redirect", location = "/index2.jsp", type = "redirect"),
              @Result(name = "forward", location = "/index.jsp"),
              @Result(name = "json", type = "json", params = { "root", "responseMap" }) })
      public class UserAction extends ActionSupport {
      
          private Map<String, Object> responseMap = new HashMap<String, Object>();
      
          @Autowired
          private UserService userService;
      
          public UserAction() {
              System.out.println("-----call UserAction 無參構造方法");
          }
      
          @Action("saveUser")
          public String saveUser() {
              userService.saveUser();
              return "json";
          }
      
          public Map<String, Object> getResponseMap() {
              return responseMap;
          }
      
          public void setResponseMap(Map<String, Object> responseMap) {
              this.responseMap = responseMap;
          }
      
      }
      復制代碼

       

      Service:

      package cn.qlq.service;
      
      public interface UserService {
          public void saveUser();
      }
      復制代碼
      package cn.qlq.service;
      
      import org.springframework.beans.factory.annotation.Autowired;
      import org.springframework.stereotype.Service;
      
      import cn.qlq.dao.UserDao;
      
      @Service
      public class UserServiceImpl implements UserService {
      
          @Autowired
          private UserDao userDao;
      
          public UserServiceImpl() {
              System.out.println("----- call UserServiceImpl 無參構造方法");
          }
      
          @Override
          public void saveUser() {
              userDao.saveUser();
          }
      
      }
      復制代碼

       

      Dao:

      復制代碼
      package cn.qlq.dao;
      
      public interface UserDao {
      
          public void saveUser();
      }
      復制代碼
      復制代碼
      package cn.qlq.dao;
      
      import org.springframework.stereotype.Repository;
      
      @Repository
      public class UserDaoImpl implements UserDao {
      
          public UserDaoImpl() {
              System.out.println("-----call   UserDaoImpl 無參構造");
          }
      
          @Override
          public void saveUser() {
              try {
                  Thread.sleep(4 * 1000);
              } catch (InterruptedException e) {
                  e.printStackTrace();
              }
              System.out.println("----user dao (save user)---");
          }
      
      }
      復制代碼

      啟動服務,查看控制臺:(證明容器啟動創建對象)

       

      多次訪問Action查看控制臺:

       總結:

      Action是struts默認多例:(注入Person類對象)

      service層,默認是單例(注入GroupDaoImpl對象)

      dao層默認也是單例,所以我們在多次訪問的時候容器只創建Action層對象,并將Service與dao存在的對象注入進去。也就是容器有多個Action對象,但是只有一個Service、一個Dao對象。

       也就是我們上面的配置從Action到service到dao的作用域是多-單-單,:

       

      2.測試 action-service-dao是多-單-多 模式

      修改DaoImpl配置:

       

       多次訪問Action查看控制臺:

       總結:對于多-單-多的模式依舊是容器有多個Acction,一個service,一個dao對象。因為容器在創建action的時候在容器中可以找到service對象、且service是單例對象,所以不會創建service對象,也就不會創建dao對象。

       

      3.測試 action-service-dao是多-多-多 模式

       將service也修改為多例:

       多次訪問Action查看控制臺:

      總結:對于多-多-多 模式,每次創建Action之后由于要注入service對象,service也是多例,所以會創建service對象,創建service注入dao對象,dao對象也是多例,所以會創建dao對象。也就是每個請求action到dao都會創建新對象。

       

      4.測試 action-service-dao是多-多-單 模式

       重新將dao設為單例:

       

       多次訪問Action:

       

       總結:

        對于多-多-單 模式,每次創建Action之后由于要注入service對象,service也是多例,所以會創建service對象,創建service注入dao對象,dao對象是單例,所以不會創建dao對象。也就是每個請求action予service都會創建新對象,dao不會創建新對象。

       

       2.測試單例多例的線程安全問題(dao與service層單例存在線程安全問題)

       1.測試多-單-單模式

         Struts默認是多例,所以我們測試普通開發情況下的多-單-單的問題,假設dao有一成員變量,我們多個訪問同時修改成員變量的值,查看結果:

      dao的代碼:

      復制代碼
      package cn.qlq.dao;
      
      import org.slf4j.Logger;
      import org.slf4j.LoggerFactory;
      import org.springframework.stereotype.Repository;
      
      @Repository
      public class UserDaoImpl implements UserDao {
          private static Logger log = LoggerFactory.getLogger(UserDaoImpl.class);
          private int i = 1;
      
          public UserDaoImpl() {
              System.out.println("-----call   UserDaoImpl 無參構造");
          }
      
          @Override
          public void saveUser() {
              log.info("------threamName:{},value:{}", Thread.currentThread().getName(), String.valueOf(i++));
          }
      
      }
      復制代碼

       

      service是單例:

      復制代碼
      package cn.qlq.service;
      
      import org.springframework.beans.factory.annotation.Autowired;
      import org.springframework.stereotype.Service;
      
      import cn.qlq.dao.UserDao;
      
      @Service
      public class UserServiceImpl implements UserService {
      
          @Autowired
          private UserDao userDao;
      
          public UserServiceImpl() {
              System.out.println("----- call UserServiceImpl 無參構造方法");
          }
      
          @Override
          public void saveUser() {
              userDao.saveUser();
          }
      
      }
      復制代碼

       

      Action還是上面代碼。

       

      測試代碼:(模擬開啟300個線程去訪問Action)

      復制代碼
      public class MyThread implements Runnable {
      
          @Override
          public void run() {
              HttpUtils.doGet("http://localhost/struts/saveUser.do");
          }
      
          public static void main(String[] args) {
              MyThread mt = new MyThread();
              for (int i = 0; i < 300; i++) {
                  new Thread(mt).start();
              }
          }
      
      }
      復制代碼

       

      復制代碼
      import java.io.BufferedReader;
      import java.io.IOException;
      import java.io.InputStreamReader;
      import java.net.URI;
      import java.util.ArrayList;
      import java.util.HashMap;
      import java.util.Iterator;
      import java.util.List;
      import java.util.Map;
      
      import org.apache.http.HttpEntity;
      import org.apache.http.HttpResponse;
      import org.apache.http.HttpStatus;
      import org.apache.http.NameValuePair;
      import org.apache.http.StatusLine;
      import org.apache.http.client.HttpClient;
      import org.apache.http.client.entity.UrlEncodedFormEntity;
      import org.apache.http.client.methods.CloseableHttpResponse;
      import org.apache.http.client.methods.HttpGet;
      import org.apache.http.client.methods.HttpPost;
      import org.apache.http.entity.StringEntity;
      import org.apache.http.impl.client.CloseableHttpClient;
      import org.apache.http.impl.client.DefaultHttpClient;
      import org.apache.http.impl.client.HttpClients;
      import org.apache.http.message.BasicNameValuePair;
      import org.apache.http.protocol.HTTP;
      import org.apache.http.util.EntityUtils;
      import org.slf4j.Logger;
      import org.slf4j.LoggerFactory;
      
      public class HttpUtils {
      
          private static Logger logger = LoggerFactory.getLogger(HttpUtils.class);
      
          /**
           * get請求
           * 
           * @return
           */
          public static String doGet(String url) {
              try {
                  HttpClient client = new DefaultHttpClient();
                  // 發送get請求
                  HttpGet request = new HttpGet(url);
      
                  HttpResponse response = client.execute(request);
      
                  /** 請求發送成功,并得到響應 **/
                  if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
                      /** 讀取服務器返回過來的json字符串數據 **/
                      String strResult = EntityUtils.toString(response.getEntity(), "utf-8");
                      return strResult;
                  }
              } catch (IOException e) {
                  logger.debug("get data error");
              }
      
              return null;
          }
      
      }
      復制代碼

       

      日志采用slf4j配置:

      復制代碼
      log4j.rootLogger=info,B
      
      log4j.appender.A=org.apache.log4j.ConsoleAppender
      log4j.appender.A.layout=org.apache.log4j.PatternLayout
      log4j.appender.A.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%c]-[%p] %m%n
      
      log4j.appender.B=org.apache.log4j.RollingFileAppender
      log4j.appender.B.File=E:\\test.log
      log4j.appender.B.MaxFileSize=10MB
      log4j.appender.B.MaxBackupIndex=5
      log4j.appender.B.layout=org.apache.log4j.PatternLayout
      log4j.appender.B.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%c]-[%p] %m%n
      復制代碼

       

      查看訪問之后的日志:

      復制代碼
      2018-08-30 22:12:19 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-90,value:1
      2018-08-30 22:12:19 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-275,value:2
      2018-08-30 22:12:19 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-94,value:3
      2018-08-30 22:12:19 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-174,value:4
      2018-08-30 22:12:19 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-221,value:5
      2018-08-30 22:12:19 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-294,value:6
      2018-08-30 22:12:19 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-123,value:7
      2018-08-30 22:12:19 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-93,value:8
      2018-08-30 22:12:20 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-103,value:9
      2018-08-30 22:12:20 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-80,value:10
      2018-08-30 22:12:20 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-15,value:11
      2018-08-30 22:12:20 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-133,value:12
      2018-08-30 22:12:20 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-120,value:13
      2018-08-30 22:12:20 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-239,value:14
      2018-08-30 22:12:20 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-54,value:15
      2018-08-30 22:12:20 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-44,value:16
      2018-08-30 22:12:20 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-264,value:17
      2018-08-30 22:12:21 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-51,value:18
      2018-08-30 22:12:21 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-272,value:19
      2018-08-30 22:12:21 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-139,value:20
      2018-08-30 22:12:21 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-143,value:21
      2018-08-30 22:12:21 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-69,value:22
      2018-08-30 22:12:21 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-26,value:23
      2018-08-30 22:12:21 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-178,value:24
      2018-08-30 22:12:21 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-171,value:25
      2018-08-30 22:12:21 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-203,value:26
      2018-08-30 22:12:21 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-118,value:27
      2018-08-30 22:12:21 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-238,value:28
      2018-08-30 22:12:21 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-24,value:29
      2018-08-30 22:12:21 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-163,value:30
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-3,value:31
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-135,value:32
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-297,value:33
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-234,value:34
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-169,value:35
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-70,value:36
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-76,value:37
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-288,value:38
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-95,value:39
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-47,value:40
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-98,value:41
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-60,value:42
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-79,value:43
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-67,value:44
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-102,value:45
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-292,value:46
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-145,value:47
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-20,value:48
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-236,value:49
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-246,value:50
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-115,value:51
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-162,value:52
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-148,value:53
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-228,value:54
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-78,value:55
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-42,value:56
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-189,value:57
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-37,value:58
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-167,value:59
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-63,value:60
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-53,value:61
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-198,value:62
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-140,value:63
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-213,value:64
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-84,value:65
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-242,value:66
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-61,value:67
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-83,value:68
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-210,value:69
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-104,value:70
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-225,value:71
      2018-08-30 22:12:22 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-277,value:72
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-91,value:73
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-188,value:74
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-50,value:75
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-81,value:76
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-132,value:77
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-48,value:78
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-149,value:79
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-197,value:80
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-278,value:81
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-124,value:82
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-146,value:83
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-32,value:84
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-159,value:85
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-122,value:86
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-269,value:87
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-243,value:88
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-17,value:89
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-55,value:90
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-202,value:91
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-191,value:92
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-71,value:93
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-2,value:94
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-256,value:95
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-68,value:96
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-181,value:97
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-18,value:98
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-46,value:99
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-14,value:100
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-258,value:101
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-96,value:102
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-157,value:103
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-116,value:104
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-180,value:105
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-223,value:106
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-199,value:107
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-266,value:108
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-153,value:109
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-142,value:110
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-241,value:111
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-137,value:112
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-113,value:113
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-154,value:114
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-271,value:115
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-301,value:116
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-279,value:117
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-166,value:118
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-77,value:119
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-127,value:120
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-22,value:121
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-286,value:122
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-298,value:123
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-224,value:124
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-240,value:125
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-151,value:126
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-43,value:127
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-293,value:128
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-270,value:129
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-284,value:130
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-164,value:131
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-274,value:132
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-73,value:133
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-62,value:134
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-105,value:135
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-7,value:136
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-82,value:137
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-200,value:138
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-41,value:139
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-25,value:140
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-27,value:141
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-150,value:142
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-192,value:143
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-35,value:144
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-19,value:145
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-134,value:146
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-211,value:147
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-173,value:148
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-260,value:149
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-111,value:150
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-112,value:151
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-117,value:152
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-49,value:153
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-282,value:154
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-16,value:155
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-254,value:156
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-12,value:157
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-209,value:158
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-119,value:159
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-108,value:160
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-208,value:161
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-250,value:162
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-175,value:163
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-29,value:164
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-235,value:165
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-212,value:166
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-176,value:167
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-92,value:168
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-170,value:169
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-283,value:170
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-64,value:171
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-226,value:172
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-215,value:173
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-185,value:174
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-100,value:175
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-30,value:176
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-85,value:177
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-45,value:178
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-110,value:179
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-155,value:180
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-187,value:181
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-299,value:182
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-156,value:183
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-33,value:184
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-52,value:185
      2018-08-30 22:12:23 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-201,value:186
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-276,value:187
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-296,value:188
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-263,value:189
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-109,value:190
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-290,value:191
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-8,value:192
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-193,value:193
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-129,value:194
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-141,value:195
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-56,value:196
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-40,value:197
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-39,value:198
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-88,value:199
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-195,value:200
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-97,value:201
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-257,value:202
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-196,value:203
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-177,value:204
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-168,value:205
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-36,value:206
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-4,value:207
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-161,value:208
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-291,value:210
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-267,value:209
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-101,value:211
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-86,value:212
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-273,value:213
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-253,value:214
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-216,value:215
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-218,value:216
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-13,value:217
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-231,value:218
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-87,value:219
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-249,value:220
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-165,value:221
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-172,value:222
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-227,value:223
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-190,value:224
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-160,value:225
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-219,value:226
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-237,value:227
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-204,value:228
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-144,value:229
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-59,value:230
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-295,value:231
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-38,value:232
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-281,value:233
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-262,value:234
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-268,value:235
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-244,value:236
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-74,value:237
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-265,value:238
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-158,value:239
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-58,value:241
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-125,value:240
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-147,value:242
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-21,value:243
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-72,value:244
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-10,value:245
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-57,value:246
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-207,value:247
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-280,value:248
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-179,value:249
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-247,value:250
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-130,value:251
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-259,value:252
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-251,value:253
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-261,value:254
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-75,value:255
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-107,value:255
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-220,value:256
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-128,value:257
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-300,value:258
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-248,value:259
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-285,value:260
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-114,value:261
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-89,value:262
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-289,value:263
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-230,value:264
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-23,value:265
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-66,value:267
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-222,value:268
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-184,value:266
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-6,value:269
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-245,value:270
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-186,value:271
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-214,value:272
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-106,value:273
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-28,value:274
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-252,value:275
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-194,value:276
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-138,value:277
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-9,value:278
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-136,value:279
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-183,value:278
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-255,value:280
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-152,value:281
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-232,value:283
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-131,value:282
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-31,value:284
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-206,value:285
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-287,value:286
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-126,value:287
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-65,value:288
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-182,value:289
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-229,value:290
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-205,value:289
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-34,value:291
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-121,value:292
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-5,value:294
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-11,value:293
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-233,value:295
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-217,value:296
      2018-08-30 22:12:24 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-99,value:297
      復制代碼

        查看日志發現普通的SSH環境在service與dao是單例的情況下,如果存在成員變量存在線程安全問題,結果不是我們預期的結果。

      2.解決線程安全問題的簡單辦法

      解決辦法一:線程同步sychronized

      代碼修改為下面代碼:

      復制代碼
      package cn.qlq.dao;
      
      import java.util.concurrent.atomic.AtomicInteger;
      
      import org.slf4j.Logger;
      import org.slf4j.LoggerFactory;
      import org.springframework.stereotype.Repository;
      
      @Repository
      public class UserDaoImpl implements UserDao {
          private static Logger log = LoggerFactory.getLogger(UserDaoImpl.class);
          private int i = 1;
      
          public UserDaoImpl() {
              System.out.println("-----call   UserDaoImpl 無參構造");
          }
      
          @Override
          public synchronized void saveUser() {
              log.info("------threamName:{},value:{}", Thread.currentThread().getName(), String.valueOf(i++));
          }
      
      }
      復制代碼

       

      清空日志,重啟服務進行測試,日志如下:

      復制代碼
      2018-08-30 22:22:58 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-288,value:1
      ...
      2018-08-30 22:23:01 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-41,value:290
      2018-08-30 22:23:01 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-299,value:291
      2018-08-30 22:23:01 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-100,value:292
      .... 2018-08-30 22:23:45 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-40,value:599 2018-08-30 22:23:45 [cn.qlq.dao.UserDaoImpl]-[INFO] ------threamName:http-nio-80-exec-104,value:600
      復制代碼

      發現解決線程安全的問題。

       

      解決辦法二:使用JDK并發包的AtomicInteger代替in型

      復制代碼
      package cn.qlq.dao;
      
      import java.util.concurrent.atomic.AtomicInteger;
      
      import org.slf4j.Logger;
      import org.slf4j.LoggerFactory;
      import org.springframework.stereotype.Repository;
      
      @Repository
      public class UserDaoImpl implements UserDao {
          private static Logger log = LoggerFactory.getLogger(UserDaoImpl.class);
          private AtomicInteger i = new AtomicInteger(1);
      
          public UserDaoImpl() {
              System.out.println("-----call   UserDaoImpl 無參構造");
          }
      
          @Override
          public void saveUser() {
              log.info("------threamName:{},value:{}", Thread.currentThread().getName(), String.valueOf(i.incrementAndGet()));
          }
      
      }
      復制代碼

      總結:

        對于SSH模式的應用,在dao層和service層也存在線程安全問題,所以在dao層和service層我們一般不會定義成員變量,以確保線程安全。但是在Action層由于是多例,一個請求一個實例,所以不會產生現場安全問題。因為操作的就不是同一個實例。

        解決線程安全的方法可以是加synchronized關鍵字或者使用JDK并發包下的AtomicXXX類代替原來的數據類型。

       

       

       

      posted on 2023-09-26 17:16  小小鳥兒!  閱讀(170)  評論(0)    收藏  舉報

      主站蜘蛛池模板: 日本亚洲一区二区精品| 日韩一区二区三区女优丝袜| 国产精品一线天粉嫩av| 平舆县| 亚洲国产精品一区二区久| 精品国产高清中文字幕| 无套内谢少妇毛片在线| 中文字幕乱码熟妇五十中出| 国产va免费精品观看| 亚洲欧美在线一区中文字幕| 日韩精品av一区二区三区| 无码人妻斩一区二区三区| 最新精品国偷自产在线美女足| 久久人人97超碰爱香蕉| 国产一区二区午夜福利久久| 成人午夜激情在线观看 | 爱啪啪av导航| 亚洲熟妇自偷自拍另欧美| 四虎国产精品永久地址99| 久久国产精品精品国产色| 国产精品大片中文字幕| 国产精品乱码一区二区三| 亚洲不卡av不卡一区二区| 国产精品久久久久影院色| 国产成人午夜精品永久免费| 日韩中文字幕v亚洲中文字幕| 狠狠色婷婷久久综合频道日韩 | 丰满少妇高潮无套内谢| 亚洲综合在线日韩av| 国产精品国产三级国产专i| 亚洲日本va午夜在线影院| 国产精品久久毛片| 最新亚洲春色av无码专区| 视频一区视频二区亚洲视频 | 日韩人妻久久精品一区二区| 欧美一区二区| av天堂亚洲天堂亚洲天堂| 中文字幕无码av不卡一区| 日本一区二区三区免费播放视频站 | 久久精品色一情一乱一伦| 亚洲精品国偷自产在线99人热|