Any hints ... ? Thanks, Lars.
Begin forwarded message:
Date: Mon, 22 Apr 2002 22:34:37 +0100
From: "Michael Watson" <[EMAIL PROTECTED]>
To: "xindice" <[EMAIL PROTECTED]>
Subject: Concurrent Xupdate problems
I am attempting to write a multi-user application, where each user
would act as an Xindice database client. To this end my application
needs to ensure that records correctly locked etc whilst updates are
made. Ideally, transaction processing would be helpful, but not
essential. I have succeeded in writing a small test program to create
and update records in the database. This program performs a mixture of
xpath queries, document insertions, Sequencer increments and xupdates.
However, When I attempt to run two or more instances of the program
concurrently from the same server, the Xupdates on all but one of the
clients will crash causing a exception on the clients. I have tried
to identify the precise cause of the problem. It is my belief that
the fault lies entirely within the Xupdate tasks (all the other parts
of the program seem to run OK if the Xupdates are disabled).
I have produces a small test program comprising Xupdates only. This
program simply attempts to rename a record and then rename it back
again. It is possible to run the program concurrently with itself
knowing that each program instance will update different records
so they should not interfere with each other. However, this program
exhibits exactly the same fault as the main program.
Here is the XML of one entry in the database:
<?xml version="1.0" encoding="UTF-8"?>
<version_managed_component>
<component_identifier>23</component_identifier>
<latest>
<latest_created>
<version_id>
<l1>1</l1>
<l2>3</l2>
</version_id>
</latest_created>
<latest_created>
<version_id>
<l1>2</l1>
<l2>6</l2>
</version_id>
</latest_created>
</latest>
</version_managed_component>
Here is the source code of my test program: It should be invoked with an
argument matching a component_id in the database (a different one for each
program invocation).
/*
* xupdatetest.java
*
* Created on 22 April 2002, 21:01
*/
package xupdatetest;
import org.xmldb.api.base.*;
import org.xmldb.api.modules.*;
import org.xmldb.api.*;
// For the dbXML specific CollectionManager service
import org.apache.xindice.client.xmldb.services.*;
/**
*
* @author root
* @version
*/
public class xupdatetest
{
static org.xmldb.api.base.Collection col;
static XUpdateQueryService update_service;
/** Creates new xupdatetest */
public xupdatetest()
{
}
public static long update(String command_set)
throws XMLDBException
{
long result;
String xupdate =
"<xu:modifications version=\"1.0\"\n"
+ " xmlns:xu=\"http://www.xmldb.org/xupdate\"\n"
+ ">\n"
+ command_set
+ "</xu:modifications>";
try
{
result = update_service.update(xupdate);
}
catch (XMLDBException e)
{
System.out.println("Update: Exception "+e.getMessage()
+" on Query "+xupdate);
throw e;
}
return result;
}
/**
* @param args the command line arguments
*/
private static void init()
throws ClassNotFoundException, InstantiationException,
IllegalAccessException, XMLDBException
{
String driver = "org.apache.xindice.client.xmldb.DatabaseImpl";
Class c = Class.forName(driver);
Database database = (Database) c.newInstance();
DatabaseManager.registerDatabase(database);
col = DatabaseManager.getCollection("xmldb:xindice:///db/docs/xut");
update_service =
(XUpdateQueryService)
col.getService("XUpdateQueryService","1.0");
}
public static void main (String args[])
{
String id = args[0];
long done;
try
{
init();
while (true)
{
String lock_latest_version_record =
" <xu:rename select =
\"/version_managed_component[component_identifier='"+id+"']/latest/latest_cr
eated\">"
+ "locked_latest_created"
+ "</xu:rename>\n";
done = update(lock_latest_version_record);
if (done == 0)
{
System.out.println("Cannot lock "+id);
}
else
{
System.out.println("locked "+id);
}
String unlock_latest_version_record =
" <xu:rename select =
\"/version_managed_component[component_identifier='"+id+"']/latest/locked_la
test_created\">"
+ "latest_created"
+ "</xu:rename>\n";
done = update(unlock_latest_version_record);
if (done == 0)
{
System.out.println("Cannot unlock "+id);
}
else
{
System.out.println("unlocked "+id);
}
}
}
catch (Exception e)
{
System.out.println("Exception "+e.getMessage());
}
finally
{
try
{
if (col != null)
col.close();
}
catch(Exception e)
{
System.out.println("Collection failed to close");
}
}
}
}
The fault report is as follows:
org.apache.xindice.client.corba.db.APIException:
IDL:org/apache/xindice/client/corba/db/APIException:1.0
at
org.apache.xindice.client.corba.db.APIExceptionHelper.read(APIExceptionHelpe
r.java:112)
at
org.apache.xindice.client.corba.db._CollectionStub.queryCollection(_Collecti
onStub.java:834)
at
org.apache.xindice.client.xmldb.services.XUpdateQueryServiceImpl.updateResul
t(XUpdateQueryServiceImpl.java:165)
at
org.apache.xindice.client.xmldb.services.XUpdateQueryServiceImpl.update(XUpd
ateQueryServiceImpl.java:185)
at xupdatetest.xupdatetest.update(xupdatetest.java:43)
at xupdatetest.xupdatetest.main(xupdatetest.java:102)
Update: Exception Query Processing Error on Query <xu:modifications
version="1.0"
xmlns:xu="http://www.xmldb.org/xupdate"
>
<xu:rename select =
"/version_managed_component[component_identifier='0']/latest/locked_latest_c
reated">latest_created</xu:rename>
</xu:modifications>
Exception Query Processing Error
Could anyone please advise me of the status of Xindice in regard to
concurrent operation.
I am quite happy to prepare code for single user operation for now as long
as I know when
concurrent operation will be fully operational.
Regards,
Michael Watson
--
______________________________________________________________________
Lars Martin mailto:[EMAIL PROTECTED]
SMB GmbH http://www.smb-tec.com
----------------------------------------------------------------------
Post a message: mailto:[EMAIL PROTECTED]
Unsubscribe: mailto:[EMAIL PROTECTED]
Contact administrator: mailto:[EMAIL PROTECTED]
Read archived messages: http://archive.xmldb.org/
----------------------------------------------------------------------