Re: [Asterisk-java-devel] Does each received event creates a new Thread?
Brought to you by:
srt
From: S. B. S. <bs...@no...> - 2016-02-12 02:55:37
|
By your code won't work as you haven't registered yourself as a listener. Have a look at the Hello Events example here; https://maven.reucon.com/projects/public/asterisk-java/1.0.0.CI-SNAPSHOT/asterisk-java/tutorial.html On 12/02/16 11:09, S. Brett Sutton wrote: > No, events are generated from a single 'event handling loop'. > > So whilst the event will generated in a different thread to you main > thread all events come from one thread. > > Note: this does have implications when processing events. If the > processing logic does long running tasks then you can block the event > thread. If you do this for too long than asterisk will disconnect the > manager connection. > > Brett > > On 11/02/16 21:32, Jose Baez wrote: >> Hello! >> >> >> With this lines of code, when I receive a new Event, is a new Thread >> created for each "handleEvent()" ? Or will "handleEvent()" start to >> run when the previous "handleEvent" is completely finished? >> >> public class AsteriskJava implements ManagerEventListener { >> >> ... >> ... >> >> public static main () { >> >> try { >> >> AsteriskJava asteriskJava = new AsteriskJava(); >> asteriskJava.run(); >> >> } catch { } >> } >> >> @Override >> public void onManagerEvent(ManagerEvent event) { >> >> if (event.getClass() == NewExtenEvent.class) { >> *handleEvent((NewExtenEvent) event);* >> } >> else if ((event.getClass() == ... >> ... >> ... >> >> } >> >> protected void *handleEvent (NewExtenEvent event)* { } >> ... >> ... >> >> } >> ___ >> ___ >> >> >> >> Thank you. >> >> >> >> >> >> ------------------------------------------------------------------------------ >> Site24x7 APM Insight: Get Deep Visibility into Application Performance >> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month >> Monitor end-to-end web transactions and take corrective actions now >> Troubleshoot faster and improve end-user experience. Signup Now! >> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 >> >> >> _______________________________________________ >> Asterisk-java-devel mailing list >> Ast...@li... >> https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel > |