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

相关代码

 @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", "");

    }
海绵宝宝撒
浏览 1158回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP