1) Client output.
run:
[java] WS HOME appserver-sqe
[java]
url=http://localhost:8080/locking/test/?tc=initData&nc=2&ns=1&nt=2&ca=2&sa=10&ia=50
[java] MESSAGE-initData: partTotal=100,
expectedChange=6
[java] 3 Threads starts for updateWPLV
[java]
url=http://localhost:8080/locking/test/?tc=updateWPLV&uid=1
[java]
url=http://localhost:8080/locking/test/?tc=updateWPLV&uid=3
[java]
url=http://localhost:8080/locking/test/?tc=updateWPLV&uid=2
[java] MESSAGE: updateWPLV, uID=1, pID=2,
succeed=true
[java] MESSAGE: updateWPLV, uID=2, pID=2,
succeed=false
[java] MESSAGE: updateWPLV, uID=3, pID=1,
succeed=true
[java] Done multi-threading!
[java]
url=http://localhost:8080/locking/test/?tc=checkPLV
[java] MESSAGE-checkPLV: oldPartVTotal=100,
newPartVTotal=108
[java] MESSAGE-checkPLV: real change=8,
expected change=6
[java] MESSAGE: Failed with Pesssmistic
Locking (V), 2 out of 3 concurrent transactions are completed.
[java] Generating report
at
/space/test1/SRC/c10/appserver-sqe/test_results.xml
[java]
-----------------------------------------
[java] -
JPA2-WAR-J2DB-locking:checkPLV: FAIL -
[java] -
JPA2-WAR-J2DB-locking:initData: PASS -
[java]
-----------------------------------------
[java] Total PASS: 1
[java] Total FAIL: 1
[java] Total DNR: 0
[java]
-----------------------------------------
2) server.log
[#|2009-09-28T16:53:45.130-0700|INFO|glassfish|null|_ThreadID=49;_ThreadName=Thread-3;|**********1.
initData**********|#]
[#|2009-09-28T16:53:45.131-0700|INFO|glassfish|null|_ThreadID=49;_ThreadName=Thread-3;|NC=2,
NS=1, NT=2|#]
[#|2009-09-28T16:53:45.132-0700|INFO|glassfish|null|_ThreadID=49;_ThreadName=Thread-3;|CA=2,
SA=10, IA=50|#]
[#|2009-09-28T16:53:45.222-0700|INFO|glassfish|null|_ThreadID=49;_ThreadName=Thread-3;|partTotal=100,
partVTotal=100|#]
[#|2009-09-28T16:53:48.326-0700|WARNING|glassfish|org.eclipse.persistence.session.file:/space/test1/v3/glassfish/domains/domain1/applications/locking/WEB-INF/classes/-pu1|_ThreadID=50;_ThreadName=Thread-3;|
Local Exception Stack:
Exception [EclipseLink-5006] (Eclipse Persistence Services -
2.0.0.v20090821-r4934):
org.eclipse.persistence.exceptions.OptimisticLockException
Exception Description: The object [Product id=2, amount=48] cannot be
updated because it has changed or been deleted since it was last read.
Class> jpa20.war.locking.entity.PartV Primary Key> [2]
at
org.eclipse.persistence.exceptions.OptimisticLockException.objectChangedSinceLastReadWhenUpdating(OptimisticLockException.java:137)
at
org.eclipse.persistence.descriptors.VersionLockingPolicy.validateUpdate(VersionLockingPolicy.java:716)
at
org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.updateObjectForWriteWithChangeSet(DatabaseQueryMechanism.java:1145)
at
org.eclipse.persistence.queries.UpdateObjectQuery.executeCommitWithChangeSet(UpdateObjectQuery.java:84)
at
org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:286)
at
org.eclipse.persistence.queries.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:58)
at
org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:670)
at
org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:589)
at
org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:109)
at
org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:86)
at
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2864)
at
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1208)
at
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1190)
at
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1150)
at
org.eclipse.persistence.internal.sessions.CommitManager.commitChangedObjectsForClassWithChangeSet(CommitManager.java:233)
at
org.eclipse.persistence.internal.sessions.CommitManager.commitAllObjectsForClassWithChangeSet(CommitManager.java:163)
at
org.eclipse.persistence.internal.sessions.CommitManager.commitAllObjectsWithChangeSet(CommitManager.java:116)
at
org.eclipse.persistence.internal.sessions.AbstractSession.writeAllObjectsWithChangeSet(AbstractSession.java:3229)
at
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabase(UnitOfWorkImpl.java:1400)
at
org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.commitToDatabase(RepeatableWriteUnitOfWork.java:521)
at
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithPreBuiltChangeSet(UnitOfWorkImpl.java:1546)
at
org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.writeChanges(RepeatableWriteUnitOfWork.java:360)
at
org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(EntityManagerImpl.java:609)
at
com.sun.enterprise.container.common.impl.EntityManagerWrapper.flush(EntityManagerWrapper.java:409)
at
jpa20.war.locking.bean.TestEJB.updateWithPessimisticLockV(TestEJB.java:231)
at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at
java.lang.reflect.Method.invoke(Method.java:597)
at
org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1038)
at
org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1110)
at
com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:5076)
at
com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:601)
at
com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:775)
at
com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:553)
at
com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doAround(SystemInterceptorProxy.java:157)
at
com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:139)
at
sun.reflect.GeneratedMethodAccessor120.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at
java.lang.reflect.Method.invoke(Method.java:597)
at
com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:836)
at
com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:775)
at
com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:349)
at
com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:5048)
at
com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:5036)
at
com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:190)
at
com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:84)
at
$Proxy163.updateWithPessimisticLockV(Unknown Source)
at
jpa20.war.locking.bean.__EJB31_Generated__TestEJB__Intf____Bean__.updateWithPessimisticLockV(Unknown
Source)
at
jpa20.war.locking.servlet.TestServlet.processRequest(TestServlet.java:158)
at
jpa20.war.locking.servlet.TestServlet.doGet(TestServlet.java:205)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at
org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1522)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:293)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
at
com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at
com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at
org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:339)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:237)
at
com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:209)
at
com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:753)
at
com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:661)
at
com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:914)
at
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:166)
at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at
com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at
com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at
com.sun.grizzly.util.FixedThreadPool$BasicWorker.dowork(FixedThreadPool.java:379)
at
com.sun.grizzly.util.FixedThreadPool$BasicWorker.run(FixedThreadPool.java:360)
at
java.lang.Thread.run(Thread.java:619)
|#]
[#|2009-09-28T16:53:48.331-0700|WARNING|glassfish|org.eclipse.persistence.session.file:/space/test1/v3/glassfish/domains/domain1/applications/locking/WEB-INF/classes/-pu1|_ThreadID=50;_ThreadName=Thread-3;|
javax.persistence.OptimisticLockException: Exception [EclipseLink-5006]
(Eclipse Persistence Services - 2.0.0.v20090821-r4934):
org.eclipse.persistence.exceptions.OptimisticLockException
Exception Description: The object [Product id=2, amount=48] cannot be
updated because it has changed or been deleted since it was last read.
Class> jpa20.war.locking.entity.PartV Primary Key> [2]
at
org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.commitToDatabase(RepeatableWriteUnitOfWork.java:523)
at
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithPreBuiltChangeSet(UnitOfWorkImpl.java:1546)
at
org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.writeChanges(RepeatableWriteUnitOfWork.java:360)
at
org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(EntityManagerImpl.java:609)
at
com.sun.enterprise.container.common.impl.EntityManagerWrapper.flush(EntityManagerWrapper.java:409)
at
jpa20.war.locking.bean.TestEJB.updateWithPessimisticLockV(TestEJB.java:231)
at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at
java.lang.reflect.Method.invoke(Method.java:597)
at
org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1038)
at
org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1110)
at
com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:5076)
at
com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:601)
at
com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:775)
at
com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:553)
at
com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doAround(SystemInterceptorProxy.java:157)
at
com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:139)
at
sun.reflect.GeneratedMethodAccessor120.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at
java.lang.reflect.Method.invoke(Method.java:597)
at
com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:836)
at
com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:775)
at
com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:349)
at
com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:5048)
at
com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:5036)
at
com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:190)
at
com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:84)
at
$Proxy163.updateWithPessimisticLockV(Unknown Source)
at
jpa20.war.locking.bean.__EJB31_Generated__TestEJB__Intf____Bean__.updateWithPessimisticLockV(Unknown
Source)
at
jpa20.war.locking.servlet.TestServlet.processRequest(TestServlet.java:158)
at
jpa20.war.locking.servlet.TestServlet.doGet(TestServlet.java:205)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at
org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1522)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:293)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
at
com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at
com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at
org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:339)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:237)
at
com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:209)
at
com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:753)
at
com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:661)
at
com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:914)
at
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:166)
at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at
com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at
com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at
com.sun.grizzly.util.FixedThreadPool$BasicWorker.dowork(FixedThreadPool.java:379)
at
com.sun.grizzly.util.FixedThreadPool$BasicWorker.run(FixedThreadPool.java:360)
at
java.lang.Thread.run(Thread.java:619)
Caused by: Exception [EclipseLink-5006] (Eclipse Persistence Services -
2.0.0.v20090821-r4934):
org.eclipse.persistence.exceptions.OptimisticLockException
Exception Description: The object [Product id=2, amount=48] cannot be
updated because it has changed or been deleted since it was last read.
Class> jpa20.war.locking.entity.PartV Primary Key> [2]
at
org.eclipse.persistence.exceptions.OptimisticLockException.objectChangedSinceLastReadWhenUpdating(OptimisticLockException.java:137)
at
org.eclipse.persistence.descriptors.VersionLockingPolicy.validateUpdate(VersionLockingPolicy.java:716)
at
org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.updateObjectForWriteWithChangeSet(DatabaseQueryMechanism.java:1145)
at
org.eclipse.persistence.queries.UpdateObjectQuery.executeCommitWithChangeSet(UpdateObjectQuery.java:84)
at
org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:286)
at
org.eclipse.persistence.queries.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:58)
at
org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:670)
at
org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:589)
at
org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:109)
at
org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:86)
at
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2864)
at
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1208)
at
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1190)
at
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1150)
at
org.eclipse.persistence.internal.sessions.CommitManager.commitChangedObjectsForClassWithChangeSet(CommitManager.java:233)
at
org.eclipse.persistence.internal.sessions.CommitManager.commitAllObjectsForClassWithChangeSet(CommitManager.java:163)
at
org.eclipse.persistence.internal.sessions.CommitManager.commitAllObjectsWithChangeSet(CommitManager.java:116)
at
org.eclipse.persistence.internal.sessions.AbstractSession.writeAllObjectsWithChangeSet(AbstractSession.java:3229)
at
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabase(UnitOfWorkImpl.java:1400)
at
org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.commitToDatabase(RepeatableWriteUnitOfWork.java:521)
... 57 more
|#]
[#|2009-09-28T16:53:48.334-0700|INFO|glassfish|null|_ThreadID=50;_ThreadName=Thread-3;|Got
PersistenceException|#]
[#|2009-09-28T16:53:48.357-0700|INFO|glassfish|null|_ThreadID=51;_ThreadName=Thread-3;|**********7.
checkPLV*******|#]
[#|2009-09-28T16:53:48.373-0700|INFO|glassfish|null|_ThreadID=51;_ThreadName=Thread-3;|numUpdated=2|#]