Package org.itsnat.core.event

Examples of org.itsnat.core.event.ItsNatTimerEvent


                       
                        EventListener listener = new EventListener()
                        {
                            public void handleEvent(Event evt)
                            {
                                ItsNatTimerEvent timerEvt = (ItsNatTimerEvent)evt;
                                ItsNatTimerHandle handle = timerEvt.getItsNatTimerHandle();
                                long firstTime = handle.getFirstTime();
                                if ((new Date().getTime() - firstTime) > 30*60*1000) // 30 minutes
                                {
                                    handle.cancel();
                                    clientOwner.addCodeToSend("The timer for updating the client has finished");
View Full Code Here


    public void handleEvent(Event evt)
    {
        if (evt instanceof ItsNatTimerEvent)
        {
            ItsNatTimerEvent timerEvt = (ItsNatTimerEvent)evt;
            if (timerEvt.getItsNatTimerHandle() == timerHandle)
                return;
        }

        this.lastNonTimerEvent = System.currentTimeMillis();
View Full Code Here

        this.parent = parent;
    }

    public void handleEvent(Event evt)
    {
         ItsNatTimerEvent timerEvt = (ItsNatTimerEvent)evt;
         ItsNatTimerHandle handle = timerEvt.getItsNatTimerHandle();
         long lastNonTimerEvent = parent.getLastNonTimerEvent();
         if ((new Date().getTime() - lastNonTimerEvent) > 2*60*1000) // to avoid never ending pages
             handle.cancel();
    }
View Full Code Here

    {
        EventListener listener = new EventListener()
        {
            public void handleEvent(Event evt)
            {
                ItsNatTimerEvent timerEvt = (ItsNatTimerEvent)evt;
                ItsNatTimerHandle handle = timerEvt.getItsNatTimerHandle();
                long firstTime = handle.getFirstTime();
                if ((new Date().getTime() - firstTime) > 10000) // to avoid never ending ticks
                {
                    handle.cancel();
                    log("Scheduled task canceled, id: " + handle.hashCode());
View Full Code Here

        EventListener listener = new EventListener()
        {
            public void handleEvent(Event evt)
            {
                ItsNatTimerEvent timerEvt = (ItsNatTimerEvent)evt;
                ItsNatTimerHandle handle = timerEvt.getItsNatTimerHandle();
                long firstTime = handle.getFirstTime();
                if ((new Date().getTime() - firstTime) > 10000) // to avoid never ending ticks
                {
                    handle.cancel();
                    System.out.println("Timer canceled");
View Full Code Here

                removeFirstTimerHandle();
            }
        }
        else
        {
            ItsNatTimerEvent timerEvt = (ItsNatTimerEvent)evt;
            ItsNatTimerHandle handle = timerEvt.getItsNatTimerHandle();
            long firstTime = handle.getFirstTime();
            if ((new Date().getTime() - firstTime) > 10000) // to avoid never ending ticks
            {
                handle.cancel();
                outText("Timer canceled (timeout)");
            }
            else
            {
                long delay = System.currentTimeMillis() - timerEvt.getItsNatTimerHandle().scheduledExecutionTime();
                long period = handle.getPeriod();
                // El delay es para ver lo que ha tardado en procesarse el evento respecto al instante previsto
                // En el caso de fixedRate el periodo de test es peque�o pero la t�cnica permite "acelerar"
                // el delay podr� superar el periodo alguna vez pero se recuperar� (si no es demasiado peque�o)
                String msg = "OK timer, delay: " + delay + " ";
View Full Code Here

TOP

Related Classes of org.itsnat.core.event.ItsNatTimerEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.