Examples of TimerListener


Examples of com.netflix.hystrix.util.HystrixTimer.TimerListener

                public void run() {
                    child.onError(new HystrixTimeoutException());
                }
            });

            TimerListener listener = new TimerListener() {

                @Override
                public void tick() {
                    // if we can go from NOT_EXECUTED to TIMED_OUT then we do the timeout codepath
                    // otherwise it means we lost a race and the run() execution completed
View Full Code Here

Examples of com.netflix.hystrix.util.HystrixTimer.TimerListener

                         * If an async timeout was not scheduled:
                         *
                         * - We go through the same flow as we receive the same interfaces just the "timer.clear()" will do nothing.
                         */
                        // get the timer we'll use to perform the timeout
                        TimerListener l = timer.get();
                        // remove the timer from the scheduler
                        timer.clear();

                        // determine how long we should wait for, taking into account time since work started
                        // and when this thread came in to block. If invocationTime hasn't been set then assume time remaining is entire timeout value
                        // as this maybe a case of multiple threads trying to run this command in which one thread wins but even before the winning thread is able to set
                        // the starttime another thread going via the Cached command route gets here first.
                        long timeout = originalCommand.properties.executionIsolationThreadTimeoutInMilliseconds().get();
                        long timeRemaining = timeout;
                        long currTime = System.currentTimeMillis();
                        if (originalCommand.invocationStartTime != -1) {
                            timeRemaining = (originalCommand.invocationStartTime
                                    + originalCommand.properties.executionIsolationThreadTimeoutInMilliseconds().get())
                                    - currTime;

                        }
                        if (timeRemaining > 0) {
                            // we need to block with the calculated timeout
                            try {
                                return f.get(timeRemaining, TimeUnit.MILLISECONDS);
                            } catch (TimeoutException e) {
                                if (l != null) {
                                    // this perform the timeout logic on the Observable/Observer
                                    l.tick();
                                }
                            }
                        } else {
                            // this means it should have already timed out so do so if it is not completed
                            if (!f.isDone()) {
                                if (l != null) {
                                    l.tick();
                                }
                            }
                        }
                    }
                }
View Full Code Here

Examples of com.netflix.hystrix.util.HystrixTimer.TimerListener

                         * If an async timeout was not scheduled:
                         *
                         * - We go through the same flow as we receive the same interfaces just the "timer.clear()" will do nothing.
                         */
                        // get the timer we'll use to perform the timeout
                        TimerListener l = timer.get();
                        // remove the timer from the scheduler
                        timer.clear();

                        // determine how long we should wait for, taking into account time since work started
                        // and when this thread came in to block. If invocationTime hasn't been set then assume time remaining is entire timeout value
                        // as this maybe a case of multiple threads trying to run this command in which one thread wins but even before the winning thread is able to set
                        // the starttime another thread going via the Cached command route gets here first.
                        long timeout = originalCommand.properties.executionIsolationThreadTimeoutInMilliseconds().get();
                        long timeRemaining = timeout;
                        long currTime = System.currentTimeMillis();
                        if (originalCommand.invocationStartTime != -1) {
                            timeRemaining = (originalCommand.invocationStartTime
                                    + originalCommand.properties.executionIsolationThreadTimeoutInMilliseconds().get())
                                    - currTime;

                        }
                        if (timeRemaining > 0) {
                            // we need to block with the calculated timeout
                            try {
                                return f.get(timeRemaining, TimeUnit.MILLISECONDS);
                            } catch (TimeoutException e) {
                                if (l != null) {
                                    // this perform the timeout logic on the Observable/Observer
                                    l.tick();
                                }
                            }
                        } else {
                            // this means it should have already timed out so do so if it is not completed
                            if (!f.isDone()) {
                                if (l != null) {
                                    l.tick();
                                }
                            }
                        }
                    }
                }
View Full Code Here

Examples of commonj.timers.TimerListener

   public synchronized void stop(  )
   {
      LOG.debug(MSG.getMessage( Keys.STOPPING));
      Iterator             taskIterator = this.taskList.iterator(  );
      TimerTaskImpl task;
      TimerListener        listener;

      while ( taskIterator.hasNext(  ) )
      {
         task = (TimerTaskImpl) taskIterator.next(  );
         task.stop(  );
View Full Code Here

Examples of commonj.timers.TimerListener

   public synchronized void stop(  )
   {
      LOG.debug(MSG.getMessage( Keys.STOPPING));
      Iterator             taskIterator = this.taskList.iterator(  );
      TimerTaskImpl task;
      TimerListener        listener;

      while ( taskIterator.hasNext(  ) )
      {
         task = (TimerTaskImpl) taskIterator.next(  );
         task.stop(  );
View Full Code Here

Examples of commonj.timers.TimerListener

    public synchronized void stop()
    {
        Iterator taskIterator = this.taskList.iterator();
        TimerListenerWrapper task;
        TimerListener listener;

        while(taskIterator.hasNext())
        {
            task = (TimerListenerWrapper) taskIterator.next();
            task.stop();
View Full Code Here

Examples of commonj.timers.TimerListener

      Iterator taskIterator = this.m_taskList.iterator(  );
      while ( taskIterator.hasNext(  ) )
      {
         TimerTaskImpl task = (TimerTaskImpl) taskIterator.next(  );
         task.stop(  );
         TimerListener listener = task.getListener(  );
         if ( listener instanceof StopTimerListener )
         {
            ( (StopTimerListener) listener ).timerStop( task.getTimer(  ) );
         }
      }
View Full Code Here

Examples of jade.core.TimerListener

      // Update the timer that triggers the delivery of a KEEP-ALIVE packet
      if (keepAliveTimer != null) {
        Runtime.instance().getTimerDispatcher().remove(keepAliveTimer);
      }
      long now = System.currentTimeMillis();
      keepAliveTimer = new Timer(now + keepAliveTime, new TimerListener() {
        public void doTimeOut(Timer t) {
          dispatchKeepAlive();
        }
      });
      keepAliveTimer = Runtime.instance().getTimerDispatcher().add(keepAliveTimer);
View Full Code Here

Examples of jade.core.TimerListener

 
  // No need for synchronization as this is always executed within a synchronized block
  private void activateMaxDisconnectionTimer() {
    // Set the disconnection timer
    long now = System.currentTimeMillis();
    maxDisconnectionTimer = new Timer(now + maxDisconnectionTime, new TimerListener() {
      public void doTimeOut(Timer t) {
        synchronized (NIOHTTPBEDispatcher.this) {
          if (frontEndStatus != CONNECTED) {
            myLogger.log(Logger.WARNING, myID+" - Max disconnection timeout expired.");
            // The remote FrontEnd is probably down --> notify up.
View Full Code Here

Examples of javax.servlet.sip.TimerListener

        if ((null == ssm) || (as.isValid() == false)) {
            throw new IllegalStateException("Invalid SipApplicationSession");
        }

        TimerListener tl = as.getTimerListener();

        if (tl == null) {
            throw new IllegalStateException("No TimerListener is configured ");
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.