service 继承于org.nutz.service.IdEntityService
保存方法
public void saveLog(Set<RfidLog> logs) {
dao().insert(logs);
}
- 处理逻辑是多线程会调用saveLog方法进行保存日记对象
- 相关service事务配置:
$aop : {
type : 'org.nutz.ioc.aop.config.impl.JsonAopConfigration',
fields : {
itemList : [
['longsys\.rfid\.service\..+','(get|set).+','ioc:txREAD_COMMITTED'],
['longsys\.rfid\.service\..+','(save*|update|delete|remove).+','ioc:txSERIALIZABLE']
]
}
} - 数量量不多时还好,数量量一多,就报:
Exception in thread "Thread-9" org.nutz.dao.DaoException: !Nutz SQL Error: 'INSERT INTO rfid_log(id,tid,device_id,device_ant,creation_date) VALUES('ondso3lne8jlnqm8cfdk5egtch','E280110C2000731E0C6A08C4','192.168.1.116:9090',1,'2017-05-02 15:24:58') '
PreparedStatement:
'INSERT INTO rfid_log(id,tid,device_id,device_ant,creation_date) VALUES(?,?,?,?,?) '
CaseMessage=ORA-08177: 无法连续访问此事务处理
at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:104)
at org.nutz.plugins.cache.dao.CachedNutDaoExecutor._exec(CachedNutDaoExecutor.java:317)
at org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:187)
at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:66)
at org.nutz.dao.impl.interceptor.DaoLogInterceptor.filter(DaoLogInterceptor.java:22)
at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:64)
at org.nutz.dao.DaoInterceptorChain.invoke(DaoInterceptorChain.java:139)
at org.nutz.dao.impl.sql.run.NutDaoRunner.runCallback(NutDaoRunner.java:158)
at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithTransaction(NutDaoRunner.java:104)
at org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:88)
at org.nutz.dao.impl.sql.run.NutDaoRunner$1.run(NutDaoRunner.java:74)
at org.nutz.trans.Trans.exec(Trans.java:174)
at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:72)
at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:245)
at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:257)
at org.nutz.dao.impl.EntityOperator.exec(EntityOperator.java:55)
at org.nutz.dao.impl.NutDao.insert(NutDao.java:105)
at longsys.rfid.service.RfidLogService.saveLog(RfidLogService.java:74)
at longsys.rfid.service.RfidLogService$$NUTZAOP._aop_invoke(RfidLogService.java:3)
at org.nutz.aop.InterceptorChain.invoke(InterceptorChain.java:77)
at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:57)
at org.nutz.aop.interceptor.TransactionInterceptor.filter(TransactionInterceptor.java:34)
at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60)
at longsys.rfid.service.RfidLogService$$NUTZAOP.saveLog(RfidLogService.java:1)
at longsys.rfid.utils.RfidGunMessage.OutPutEPC(RfidGunMessage.java:86)
at com.clou.uhf.G3Lib.Connect.BaseConnect.ProcessUploadMsg(BaseConnect.java:143)
at com.clou.uhf.G3Lib.Connect.BaseConnect$1.run(BaseConnect.java:120)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.sql.SQLException: ORA-08177: 无法连续访问此事务处理
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:447)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:951)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:513)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:227)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:208)
at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:1046)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1336)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3613)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3714)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1378)
at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2931)
at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440)
at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929)
at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:131)
at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:493)
at org.nutz.dao.impl.sql.run.NutDaoExecutor._runPreparedStatement(NutDaoExecutor.java:308)
at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:90)
... 27 more