在SQL Server中,需要对数据操作进行先SELECT 之后UPDATE,对于这样的操作,如果出现高并发,可能导致脏读情况的发生.不能保证数据的同步. 解决方案是在事物中对表进行加更新锁: 事务一: begin tran select @count as count1 waitfor delay '00:00:30' commit tran select * from tb_name 事务二: begin tran select @count as count2 commit tran se
并发修改异常(ConcurrentModificationException) 这个异常,使用集合的时候应该很常见,这个异常产生的原因是因为java中不允许直接修改集合的结构. 先贴上个有趣的例子,给你们看看: package com.xiongda; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class Confirm { public static void mai
在运行下面这段代码时出现了并发修改异常java.util.ConcurrentModification: public static void main(String[] args) { List l = new ArrayList(); l.add(100); l.add(200); l.add(300); Iterator it = l.iterator(); while (it.hasNext()){ int num = (int)it.next(); if (num == 200){ l