Ask about BaseX event for more than one context

Thursday, 22 March 2012 · 2 messages
T
truc.cam22 Mar 2012 11:24 #
Dear BaseX team, Please see the attachment. When I use events for 2 contexts, just the first one can notify.If the notification of the 2rd context happens, the result should be "1 2 3 4". If I replace "xquery2.execute(context2)" by "xquery2.execute(context1)", I will receive right result. But this is not what I want to do. Thanks in advance. Best regards
DP
Dimitar Popov22 Mar 2012 12:08 #
Hi truc, your method "GetContext" creates a new BaseX server on each call. Since you call it twice, you end up with 2 separate BaseX server instances. You should call the following code only once:
Context context = new Context();
BaseXServer server = new BaseXServer(context);
Then for each ClientSession, you can create a new context - it is not necessary (actually, it is not recommended) to use the server context in the client. You can also check the following articles in our wiki, if you already haven't: [1] and [2]. Regards, Dimitar [1] http://docs.basex.org/wiki/Events [2] http://docs.basex.org/wiki/Code_Examples
Quoted text · truc.cam at emotive.de · 13 lines
On Mar 22, 2012, at 11:24 AM, truc.cam at emotive.de wrote: > > Dear BaseX team, > Please see the attachment. When I use events for 2 contexts, just the first one can notify.If the notification of the 2rd context happens, the result should be "1 2 3 4". > If I replace "xquery2.execute(context2)" by "xquery2.execute(context1)", I will receive right result. But this is not what I want to do. > > Thanks in advance. > > Best regards > <mainclass.java>_______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk

⚡Generated with XQuery