Re: [Asterisk-java-users] Lot of timeouts when sending actions repetedly
Brought to you by:
srt
From: Stefan R. <sr...@re...> - 2006-01-29 18:23:30
|
Try to replace=20 manager.sendEventGeneratingAction(action, 5000); by manager.sendAction(action, null); =3DStefan On Wed, 2006-01-25 at 18:02 +0100, Mattias Malmquist wrote: > Hi all! >=20 > =20 >=20 > I am currently using this simple class to monitor the queue. One > instance of this class is created once every one second (and hopefully > deleted after reaching end). >=20 > =20 >=20 > I am actually quite new at Java and thread programming so I realize > that there must be some better way to do this, but I hope this is > sufficient for the time being. >=20 > =20 >=20 > The problem (if it is a problem) I am experiencing at the moment is > that I receive one timeout every second, but it seems like I get all > the events generated by this action. >=20 > =20 >=20 > My question is this: Do I actually lose any information as I get these > timeouts or are there any other reasons for receiving them? >=20 > =20 >=20 > Never mind the horrors of my code. I just created this to get around > the deadlock I experienced when trying to send an action from the > event dispatching thread. =3D) >=20 > =20 >=20 > Thanks in advance! >=20 > =20 >=20 > // Mattias Malmquist >=20 > =20 >=20 >=20 > =20 >=20 > =20 >=20 > public class QueueStatusChecker extends Thread { >=20 > ManagerConnection manager; >=20 > EventGeneratingAction action; >=20 > =20 >=20 > public QueueStatusChecker(ManagerConnection > manager, ManagerAction action) { >=20 > this.manager =3D manager; >=20 > this.action =3D > (EventGeneratingAction)action; >=20 > } >=20 > public void run() { >=20 > try { >=20 >=20 > manager.sendEventGeneratingAction(action, 5000); >=20 > } catch (Exception e) { >=20 >=20 > if(e.getClass().getSimpleName().equals("EventTimeoutException")) { >=20 >=20 > System.out.println("Timeout"); >=20 > } >=20 > } >=20 > } >=20 > } >=20 >=20 |