The sleep mechanism is just to wait some time before checking the result_hash for the command result. The worker threads can be paused, delaying execution of the command queue.


From: Brian Lang [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 14, 2006 4:21 PM
To: [email protected]
Subject: RE: [xfire-user] CPU usage skyrockets in XFire, not as java app.

 

Just for my information, what is the sleep mechanism and push-pop type logic attempting to accomplish?

 

Regards

 


From: Phil Rosen [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 14, 2006 3:42 PM
To: [email protected]
Subject: [xfire-user] CPU usage skyrockets in XFire, not as java app.

So I have a method which is implementing an observer pattern along the lines of:

 

static public result_hash;

static public cmd_queue;

 

Function String getCmdResult(cmd){

cmd_queue.add(cmd.work)

While(!result_hash.containsKey(cmd.key){

                        Thread.sleep(10);

}          

return result_hash.remove(cmd_key);

}

 

 

This is exposed as a webservice via extending XFireServlet. When I call this webservice, the CPU usage goes to 100% and no result is returned. If I call this within a standard java app, it works as anticipated. There are worker threads processing the cmd_que, they do stuff and add the results to result_hash. The webservice just adds the work and waits for the result. What is there in Xfire that could be making this fail? Is the scope of static members limited in XFireServlets by default?

Reply via email to