This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



May 24, 2011, 1:01 PM
30 Posts

XPages not running concurrently...

  • Category: Performance
  • Platform: All
  • Release: 8.5.2
  • Role: Developer
  • Tags: session,sleep,ssjs,timeout,concurrently
  • Replies: 3
 Using two XPages agents:
 
xp1 is providing service to a long polling AJAX request - Meaning that it checks something every 10 seconds on the server and if that something is found it's returned to the AJAX request and terminates. If not, then it sleeps for 10sec and repeats. 
 
Using this code:
java.lang.Thread.currentThread().sleep(10000); 
 
Curtesy of: Mark Leusnik 
 
Works great! Except that it blocks every other XPage for that same session.
 
I have enabled "Run web agents and web services concurrently" and I have restarted the server. 
Still no go! 
 
Makes me think that XPages doesn't honor this setting. 
BUG? Or am I missing something vital here... 
 
 
Thanks! 
 
 
/J 
May 25, 2011, 10:57 AM
261 Posts
Re: XPages not running concurrently...
Hi Joacim,
 
If you use the java.lang.Thread.currentThread().sleep(10000);  statement, the current thread is halted for 10 seconds. I have limited knowledge in this specific area,  but it might be that the other XPage calls are/ should be processed by the same thread and therefore won't be processed until the 10 seconds have passed.

I don't know what you're exactly trying to do, but from what you've described I would suggest another approach: let the client (browser) handle the check-intervals. Using the javascript setInterval function you can let the browser perform a certain action (e.g. Ajax call) until it's not needed anymore.
 
Mark
 

May 29, 2011, 8:17 AM
30 Posts
Re: XPages not running concurrently...
 
 Hi there Mark!
 
 
Yes, it seems so. The behavior is  identical to when you've haven't set your agents to be able to run concurrently. An option we've had for several years with ordinary Agents...
This seems as a huge step back in my eyes, that you're only able to run ONE XPage at a time per session. (From what I understand there's only one thread per session allowed, hence this behavior.) 
 
Long AJAX polling is a common frontend technique to improve performance. Gmail is using it, among several others. Basically you issue one AJAX request and that request is live until the server returns something. If your criteria is fulfilled server-side the data is returned to the AJAX request (this thread finishes) and a new AJAX request is issued and it starts all over again. This way you don't have to hammer the server witch requests every X seconds just to see if something new has happend.
 
 
Because of the above I had to revert to setTimeout (a pattern of setTimeout is in general preferred as it will only issue a new request as the first one has finished, setInterval may introduce a race condition).
 
 
This works, but it's not an elegant solution.
 
 
Love your blog by the way! Keep it up! =) 
 
 
/J 
Jul 4, 2011, 11:05 AM
6 Posts
Re: XPages not running concurrently...
Hi!
 
Please take a look at my response in this thread of this forum:
http://www-10.lotus.com/ldd/xpagesforum.nsf/topicThread.xsp?documentId=F9B69B2341F84051852578C3003A50BE&action=openDocument
 
Might be a workaround for this limitation.

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal