Delete Build Definition via API
Hi,
I created a postop workitem save extension (server-side) that deletes a Build Definition item.
To do this I use the internal ITeamBuildService.
And I obtain an IllegalStateException exception:
Quote:
Any idea?
Thanks,
Andrea
_________________
Andrea Gabrielli
Nexen
Business Consultant
I created a postop workitem save extension (server-side) that deletes a Build Definition item.
To do this I use the internal ITeamBuildService.
ITeamBuildService buildService = getService(ITeamBuildService.class);
...
buildService.delete(buildDefinition);
And I obtain an IllegalStateException exception:
Quote:
java.lang.IllegalStateException: Illegal transaction in progress for service method call.
at com.ibm.team.repository.service.internal.TransactionService.checkValidTransaction(TransactionService.java:83)
at sun.reflect.GeneratedMethodAccessor132.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
Any idea?
Thanks,
Andrea
_________________
Andrea Gabrielli
Nexen
Business Consultant
3 answers
It's most likely due to the delete wanting to start a write transaction when an outer read transaction has already been started. That's puzzling, though, because as far as I know the operation participants (i.e. your extension) run in the same write transaction as the original operation (i.e. the work item save), so doing another write transaction within that should work OK.
We got the same exception trying to query from an event handler the build requests in queue:
java.lang.IllegalStateException: Illegal transaction in progress for service method call. at com.ibm.team.repository.service.internal.PrimitiveTransactionService.checkValidTransaction(PrimitiveTransactionService.java:86) at sun.reflect.GeneratedMethodAccessor290.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:361) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:347) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56) at com.sun.proxy.$Proxy159.checkValidTransaction(Unknown Source) at com.ibm.team.repository.service.AbstractService.checkValidTransaction(AbstractService.java:234) at com.ibm.team.build.internal.service.TeamBuildService.getQueryPageForBuildResultsFromBuildQueryCriteria(TeamBuildService.java:2230) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:361) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:347) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56) at com.sun.proxy.$Proxy1040.getQueryPageForBuildResultsFromBuildQueryCriteria(Unknown Source) at it.secservizi.rtc.open.server.event.stateChanged.BuildLaunch.waitPendingBuilds(BuildLaunch.java:611) at it.secservizi.rtc.open.server.event.stateChanged.BuildLaunch.retrieveLastBuildResult(BuildLaunch.java:565) at it.secservizi.rtc.open.server.event.stateChanged.BuildLaunch.handleEvent(BuildLaunch.java:505) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:361) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:347) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56) at com.sun.proxy.$Proxy1258.handleEvent(Unknown Source) at com.ibm.team.process.internal.service.ServerProcess.handleChangeEvent(ServerProcess.java:494) at com.ibm.team.process.internal.service.ProcessService$13.run(ProcessService.java:4642) at com.ibm.team.repository.service.internal.PrimitiveTransactionService$3.run(PrimitiveTransactionService.java:163) at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase.runTransaction(RepositoryDatabase.java:347) at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase.runInTransaction(RepositoryDatabase.java:271) at com.ibm.team.repository.service.internal.PrimitiveTransactionService.runInTransaction(PrimitiveTransactionService.java:96) at com.ibm.team.repository.service.internal.PrimitiveTransactionService.runInTransaction(PrimitiveTransactionService.java:91) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:361) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:347) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56) at com.sun.proxy.$Proxy159.runInTransaction(Unknown Source) at com.ibm.team.repository.service.internal.TransactionService.runInTransaction(TransactionService.java:37) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:361) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:347) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56) at com.sun.proxy.$Proxy823.runInTransaction(Unknown Source) at com.ibm.team.process.internal.service.ProcessService.runInTransaction(ProcessService.java:4786) at com.ibm.team.process.internal.service.ProcessService.doProcessChangeEvent(ProcessService.java:4638) at com.ibm.team.process.internal.service.ProcessService.doProcessChangeEvents(ProcessService.java:4574) at com.ibm.team.process.internal.service.ProcessService$12.run(ProcessService.java:4527) at com.ibm.team.repository.service.internal.PrimitiveTransactionService$3.run(PrimitiveTransactionService.java:163) at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase$Transaction.run(RepositoryDatabase.java:496) at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase$1.run(RepositoryDatabase.java:320) at com.ibm.team.repository.service.internal.rdb.ConnectionPoolService.withCurrentConnection(ConnectionPoolService.java:448) at sun.reflect.GeneratedMethodAccessor55.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:361) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:347) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56) at com.sun.proxy.$Proxy121.withCurrentConnection(Unknown Source) at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase.runTransaction(RepositoryDatabase.java:316) at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase.runInTransaction(RepositoryDatabase.java:271) at com.ibm.team.repository.service.internal.PrimitiveTransactionService.runInTransaction(PrimitiveTransactionService.java:96) at com.ibm.team.repository.service.internal.PrimitiveTransactionService.runInTransaction(PrimitiveTransactionService.java:91) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:361) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:347) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56) at com.sun.proxy.$Proxy159.runInTransaction(Unknown Source) at com.ibm.team.repository.service.internal.TransactionService.runInTransaction(TransactionService.java:37) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:361) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:347) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56) at com.sun.proxy.$Proxy823.runInTransaction(Unknown Source) at com.ibm.team.process.internal.service.ProcessService.runInTransaction(ProcessService.java:4786) at com.ibm.team.process.internal.service.ProcessService.processChangeEvents(ProcessService.java:4525) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:361) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:347) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56) at com.sun.proxy.$Proxy1025.processChangeEvents(Unknown Source) at com.ibm.team.process.internal.service.ProcessChangeEventsTask.runTask(ProcessChangeEventsTask.java:36) at com.ibm.team.repository.service.async.AbstractAutoScheduledTask.executeTask(AbstractAutoScheduledTask.java:92) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:361) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:347) at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56) at com.sun.proxy.$Proxy1028.executeTask(Unknown Source) at com.ibm.team.repository.service.internal.scheduler.AsynchronousTaskRunner.runTask(AsynchronousTaskRunner.java:158) at com.ibm.team.repository.service.internal.scheduler.AsynchronousTaskRunner.run(AsynchronousTaskRunner.java:119) at java.lang.Thread.run(Thread.java:761)
It's most likely due to the delete wanting to start a write transaction when an outer read transaction has already been started.
In our case, why should it be blocked if we started a read transaction (and not a write one)?
Thanks in advance.