Re: [Asterisk-java-users] how to monitor asterisk events for ever
Brought to you by:
srt
|
From: MT <moh...@gm...> - 2014-12-15 15:27:20
|
hi wayne,
thanks for your reply,
I need to monitor events forever not just for a period of time
On Mon, Dec 15, 2014 at 6:22 PM, Wayne Merricks <
way...@th...> wrote:
>
> You could just loop the sleep bit.
>
> I use the live interfaces which makes things a bit more readable but it
> still boils down to having a class somewhere that just does:
>
> public void run() {
>
> try{
> sleep(whatever amount of time);
> }catch(InterruptedException e){
> e.printStackTrace();
> }
>
> }
>
> Wayne Merricks
> The Voice Asia
>
> On 15/12/14 14:05, MT wrote:
>
> Hi,
>
> I use very long thread.sleep for listening to events for a long time and
> when times out with some daemon tools I start application again, I want to
> know is there any better solution?
>
> I use following way:
>
> public class Monitor extends AbstractManagerEventListener {
>
> private ManagerConnection managerConnection;
>
> public Monitor() throws IOException {
> ManagerConnectionFactory factory = new ManagerConnectionFactory(
> "localhost", "user", "pass");
> this.managerConnection = factory.createManagerConnection();
> }
>
> public void run() throws IOException, AuthenticationFailedException,
> TimeoutException, InterruptedException {
>
> managerConnection.addEventListener(this);
> managerConnection.login();
> Thread.sleep(new Long(1000000000));
> }
>
> public static void main(String[] args) throws Exception {
> Monitor helloEvents;
>
> helloEvents = new Monitor();
> helloEvents.run();
> }
>
> public void onManagerEvent(ManagerEvent event) {
> // Do Something
> }
>
>
>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREEhttp://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
>
>
>
> _______________________________________________
> Asterisk-java-users mailing lis...@li...://lists.sourceforge.net/lists/listinfo/asterisk-java-users
>
>
>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
>
> http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
> _______________________________________________
> Asterisk-java-users mailing list
> Ast...@li...
> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users
>
>
|