[Neo] Exception when adding and deleting in a single transaction
Johan Svensson
johan at neotechnology.com
Tue Apr 20 14:38:56 CEST 2010
Hi,
There should be no problem to do multiple modifying operations in the
same transaction. Since you are talking about statements I take it you
are using the rdf component?
What happens if you move the delete statement before the call to Tx.success()?
Regards,
Johan
On Wed, Apr 14, 2010 at 5:59 PM, Subbacharya, Madhu
<madhu.subbacharya at corp.aol.com> wrote:
> Hi,
> When I add a statement and then delete a different statement within
> a single transaction begin/end block, Tomcat is complaining about a
> dangling thread. Here is what I am doing:
> 1. Tx begin
> 2. Add a statement
> 3. If add succeeded, Tx.success()
> 4. Delete a statement
> 5. If delete failed, Tx.failure()
> 6. In the finally block of the try statement, I call Tx.finish(),
> shutdown the store, etc.
>
> I have a workaround by creating 2 separate transactions (one for the
> add and the other for the delete) and managing them independently with
> associated status codes, which works fine. However, what I would really
> like is to be able to do multiple DB modifying operations within a
> single transaction block.
> Assuming this is doable, would be nice to have a Tx.state() method that
> returns whether Tx.success() or Tx.failure() was last called.
> Thanks
> madhu
> Tomcat log:
> Apr 13, 2010 9:51:27 PM org.apache.catalina.loader.WebappClassLoader
> clearThreadLocalMap
> SEVERE: A web application created a ThreadLocal with key of type [null]
> (value [null]) and a value of type [org.neo4j.index.Isolation] (value
> [SAME_TX]) but failed to remove it when the web application was
> stopped. To prevent a memory leak, the ThreadLocal has been forcibly
> removed.
> Apr 13, 2010 9:51:27 PM org.apache.catalina.loader.WebappClassLoader
> clearReferencesThreadLocals
> WARNING: Failed to clear ThreadLocal references
> java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja
> va:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso
> rImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.apache.catalina.loader.WebappClassLoader.clearThreadLocalMap(Webapp
> ClassLoader.java:2102)
> at
> org.apache.catalina.loader.WebappClassLoader.clearReferencesThreadLocal
> s(WebappClassLoader.java:2027)
> at
> org.apache.catalina.loader.WebappClassLoader.clearReferences(WebappClas
> sLoader.java:1710)
> at
> org.apache.catalina.loader.WebappClassLoader.stop(WebappClassLoader.jav
> a:1622)
> at
> org.apache.catalina.loader.WebappLoader.stop(WebappLoader.java:710)
> at
> org.apache.catalina.core.StandardContext.stop(StandardContext.java:4649
> )
> at
> org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:9
> 24)
> at
> org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1
> 174)
> at
> org.apache.catalina.startup.HostConfig.check(HostConfig.java:1342)
> at
> org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:3
> 03)
> at
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleS
> upport.java:119)
> at
> org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.
> java:1337)
> at
> org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.pro
> cessChildren(ContainerBase.java:1601)
> at
> org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.pro
> cessChildren(ContainerBase.java:1610)
> at
> org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run
> (ContainerBase.java:1590)
> at java.lang.Thread.run(Thread.java:637)
> Caused by: java.lang.NullPointerException
> at java.lang.ThreadLocal.access$400(ThreadLocal.java:53)
> at
> java.lang.ThreadLocal$ThreadLocalMap.remove(ThreadLocal.java:436)
> ... 20 more
More information about the User
mailing list