Re: [Asterisk-java-users] Handling parallel requests toAgiScript.service() method
Brought to you by:
srt
From: Martin S. <ma...@be...> - 2008-06-18 12:19:38
|
Hello Satya, You are correct -- the AgiScript does not serialize execution to enforce any kind of thread safety. This is the usual case for highly parallel operations in Java -- there's always a tradeoff between synchronization and performance. I suggest this is a good default behavior for Asterisk-Java. I'd advise you design parallel requests to require as little shared data as possible, avoiding things like static members. If you *must* share some data, use everyone's favorite parallel data structure -- the database (or any of the thread safe collections in a static member). You'll still probably have opportunities where you can deadlock if you're not careful. There's never a free lunch :) Best of luck, Martin -----Original Message----- From: ast...@li... [mailto:ast...@li...] On Behalf Of Satya Parimi Sent: Tuesday, June 17, 2008 7:12 PM To: ast...@li... Subject: [Asterisk-java-users] Handling parallel requests toAgiScript.service() method Hello I'm setting up IVR using fastagi. I have to execute some business logic during the IVR flow I'm wondering how to handle parallel requests that come to service method. I guess at runtime a single instance of the AgiScript will serve all requests, please confirm If so, I should make my business logic thread safe, but I'm afraid that slows down the calls. What is advisable to handle parallel requests? Can I use Queues, but the AgiChannel is not Serializable Thanks for any pointers Satya ------------------------------------------------------------------------ - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Asterisk-java-users mailing list Ast...@li... https://lists.sourceforge.net/lists/listinfo/asterisk-java-users |