为了账号安全,请及时绑定邮箱和手机立即绑定

Spring中多个线程调用Service中的方法出错

Spring中多个线程调用Service中的方法出错

海绵宝宝撒 2018-08-26 15:03:00
相关代码 @Rollback(value = false)    @Test     public void test() throws Exception {     for (int i = 0; i < 10; i++) {      }         Thread thread1 = new Thread(new Runnable() {            @Override             public void run() {                for (int i = 0; i < 10; i++) {                     normal(Thread.currentThread().getId(), i);                 }             }         });         Thread thread2 = new Thread(new Runnable() {            @Override             public void run() {                for (int i = 0; i < 10; i++) {                     normal(Thread.currentThread().getId(), i);                 }             }         });         thread1.start();         thread2.start();     }    public void normal(long id, int n) {         auditLoggingService.insertAuditLogging("修改个人密码成功" + id + "/" + n, 56, 6, 0,                 BaseConstants.AuditLoggingOperatorType.MODIFY, "修改个人密码", "修改密码", 0, "", "", "无", "", BaseConstants.UserInfo.USER_CAT_INNER, "yangyan", "");     }
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 1153 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信