From: Christian Grün <christian.gruen@gmail.com>
To: Andreas Weiler <andreas.weiler@uni-konstanz.de>
Cc: The Trainspotter <wys01@btinternet.com>; "basex-talk@mailman.uni-konstanz.de" <basex-talk@mailman.uni-konstanz.de>
Sent: Tuesday, 23 October 2012, 12:55
Subject: Re: [basex-talk] Best practices for concurrency
Hi Gary,
as Andreas mentioned, the server approach will ensure that all
operations will be concurrently handled. An alternative, however, is
to create a LocalSession instance, which provides the same interface
and functionality as the ClientSession class, but does not rely on a
database server. A little example (I hope I didn't introduce
any
typos):
Context ctx = new Context();
LocalSession ls = new LocalSession(ctx);
ls.execute(new CreateDB("db", "<a/>"));
System.out.println(ls.execute(new XQuery("db:open('db')")));
ctx.close();
Best,
Christian
___________________________
On Sun, Oct 21, 2012 at 12:42 PM, Andreas Weiler
<
andreas.weiler@uni-konstanz.de> wrote:
> Hi Gary,
>
> best approach is to run a local server and then use client sessions.
> If you dont want to run a server, you need one seperate context for each
> thread.
>
> -- Andreas
>
> Am 20.10.2012 um 17:53 schrieb The Trainspotter:
>
> Hi,
>
> I've read through the online example on server concurrency, however,
>
currently I'm not running a BaseXServer instance I'm just running things
> locally. I want multiple threads in my application to be able to query the
> database at once without treading on each others toes. What's the best
> approach for doing this?
>
> I have tried querying the database using different threads but I keep
> getting internal BaseX errors which leads me to think I'm going about this
> the wrong way.
>
> Cheers
> Gary
> _______________________________________________
> BaseX-Talk mailing list
>
BaseX-Talk@mailman.uni-konstanz.de>
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk>
>
>
>
_______________________________________________
> BaseX-Talk mailing list
>
BaseX-Talk@mailman.uni-konstanz.de>
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk>