From: Conal T. <Con...@vu...> - 2004-09-12 22:57:26
|
Thanks Kal! I opened a transaction before walking my topic map, but sadly it hasn't = speeded it up at all :-( Here's the code I used: /* get the topic map from the topic map manager */ var TopicMapManager =3D = cocoon.getComponent("org.tm4j.tm4web.cocoon.TopicMapManagerComponent"); var map =3D TopicMapManager.getTopicMap("nzetc"); cocoon.releaseComponent(TopicMapManager); /* write the topic map to a file */ var walker =3D new Packages.org.tm4j.topicmap.utils.TopicMapWalker(); var writer =3D new Packages.org.tm4j.topicmap.utils.XTMWriter(); var file =3D new java.io.File(export_filename); var os =3D new java.io.FileOutputStream(file); var of =3D new Packages.org.apache.xml.serialize.OutputFormat(); of.setEncoding("UTF-8"); of.setIndenting(true); of.setIndent(2); var serializer =3D new = Packages.org.apache.xml.serialize.XMLSerializer(os, of); walker.setHandler(writer); writer.setContentHandler(serializer); =09 var txn =3D map.getProvider().openTransaction(); try { walker.walk(map); } finally { txn.abort(); } =09 /* walker.walk(map); */ cocoon.sendPage("export/nzetc.xtm"); Cheers Con > My guess is that the walk is just doing to many transactions. If you > don't have an "outer" transaction wrapping that walk, then=20 > each call to > the API will result in a separate transaction against the database - > which amounts to quite a lot of transactions to walk the whole map. >=20 > What I would recommend you try is creating a transaction to=20 > wrap around > the walk. If a transaction is already in progress, then the TM4J > Hibernate code will use that txn instead of creating one. >=20 > The code would be something like this: >=20 > ProviderTransaction txn =3D provider.getTransaction(); > try { > walker.walk(); > } finally { > txn.abort(); > } |