Hi Michele,
Send us please event log files (at SEDNA_HOME/data/event***.log). It'll be
much easy to determine where the problem is.
Ivan Shcheklein,
Sedna Team
On Tue, Jul 28, 2009 at 8:33 PM, Michele Bassanelli <
[email protected]> wrote:
> Hi,
>
> I've encountered a problem when I try to use a Sedna XML:DB API for Java in
> a multithreading application.
>
> When more than one thread try to store a different resource in the same
> collection and the operation is bounded in one transaction I get the
> following error:
>
> SEDNA Message: ERROR SE4703 The transaction is a victim of deadlock
> resolution procedure.
>
> This is the test code for replicate the problem:
>
>
>
>
> import org.xmldb.api.DatabaseManager;
> import org.xmldb.api.base.Collection;
> import org.xmldb.api.base.Database;
> import org.xmldb.api.base.Resource;
> import org.xmldb.api.base.XMLDBException;
> import org.xmldb.api.modules.CollectionManagementService;
> import org.xmldb.api.modules.TransactionService;
> import org.xmldb.api.modules.XMLResource;
>
> public class Test3 {
> public Test3() throws Exception {
>
> Database sednaDatabase;
> Class<?> clazz = Class.forName("net.cfoster.sedna.DatabaseImpl");
> sednaDatabase = (Database) (clazz.newInstance());
> DatabaseManager.registerDatabase(sednaDatabase);
>
> int numThread = 10;
> final Thread[] listThread = new Thread[numThread];
>
> for (int i = 0; i < numThread; i++) {
>
> final int count = i;
>
> listThread[i] = new Thread(new Runnable() {
> public void run() {
> Collection root = null;
> TransactionService transactionService = null;
> try {
> root =
> DatabaseManager.getCollection("xmldb:sedna://localhost:5050/Test", "SYSTEM",
> "MANAGER");
> transactionService = (TransactionService)
> root.getService("TransactionService", "1.0");
> transactionService.begin();
> Resource r = root.createResource("test" + count,
> XMLResource.RESOURCE_TYPE);
> r.setContent("<test/>");
> root.storeResource(r);
> transactionService.commit();
> } catch (Exception e) {
> e.printStackTrace();
> try {
> transactionService.rollback();
> } catch (XMLDBException e1) {
> e1.printStackTrace();
> }
> } finally {
> try {
> root.close();
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
>
> }
>
> });
>
> }
> System.out.println("init");
> for (int i = 0; i < numThread; i++) {
> listThread[i].start();
> }
>
> for (int i = 0; i < numThread; i++) {
> listThread[i].join();
> }
> System.out.println("end");
> System.exit(0);
> }
>
>
>
> public static void main(String[] args) {
> try {
> new Test3();
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
> }
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Sedna-discussion mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sedna-discussion
>
>
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Sedna-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sedna-discussion