/*
(non-Javadoc)

@see org.restcomm.protocols.ss7.map.api.MAPDialogListener#onDialogTimeout
(org.restcomm.protocols.ss7.map.api.MAPDialog)
425311
@Override
    public void onDialogTimeout(MAPDialog mapDialog) {
        logger.error(String.format("onDialogTimeout for DialogId=%d", mapDialog.getLocalDialogId()));
        this.csvWriter.incrementCounter(ERROR_DIALOGS);
    }
88934
@Override
    public void onInvokeTimeout(MAPDialog mapDialog, Long invokeId) {
        logger.error(String.format("onInvokeTimeout for Dialog=%d and invokeId=%d", mapDialog.getLocalDialogId(), invokeId));

    }
931573
function Timer(timeout, timeoutCallback) {
  this.finalTime = false;
  this.time = Date.now();
  this.TimerFunction = setTimeout(timeoutCallback, timeout);
}
602952
public void setDefaultTimeout(Duration timeout) {

        LettuceAssert.notNull(timeout, "Timeout duration must not be null");
        LettuceAssert.isTrue(!timeout.isNegative(), "Timeout duration must be greater or equal to zero");

        this.timeout = timeout;
    }
687545
function createTimeout(errorCallback, timeout) {
    var t = setTimeout(function() {
        clearTimeout(t);
        t = null;
        errorCallback({
            code:PositionError.TIMEOUT,
            message:"Position retrieval timed out."
        });
    }, timeout);
    return t;
}
625093
public CliCommandBuilder setTimeout(final int timeout) {
        if (timeout > 0) {
            addCliArgument(CliArgument.TIMEOUT, Integer.toString(timeout));
        } else {
            addCliArgument(CliArgument.TIMEOUT, null);
        }
        return this;
    }
1255766
@Override
	public void setConnectionTimeoutMS(int connectionTimeoutMS) {
    	connectionManager.getParams().setConnectionTimeout(connectionTimeoutMS);
    	http.getParams().setConnectionManagerTimeout(connectionTimeoutMS);
	}
1101477
public void onTimeout(ResponseType responseType) throws DispatcherException
	{
		if(!proxy.getAckReceived()) {
			this.cancel();
			if(responseType == ResponseType.FINAL) {
				cancel1xxTimer();
			}
			this.timedOut = true;
			if(originalRequest != null) {
				List<ProxyBranchListener> proxyBranchListeners = originalRequest.getSipSession().getSipApplicationSession().getSipContext().getListeners().getProxyBranchListeners();
				if(proxyBranchListeners != null) {
					for (ProxyBranchListener proxyBranchListener : proxyBranchListeners) {
						proxyBranchListener.onProxyBranchResponseTimeout(responseType, this);
					}
				}
			}
			// Just do a timeout response
			proxy.onBranchTimeOut(this);
			logger.warn("Proxy branch has timed out");
		} else {
			logger.debug("ACKed proxybranch has timeout");
		}
	}
1144692
public void setSoTimeout(int timeout) throws SocketException{
      super.setSoTimeout(timeout);
      if(!doing_direct) proxy.proxySocket.setSoTimeout(timeout);
   }
861314
public void setDefaultTimeout(long timeout, TimeUnit unit) {
        this.timeout = timeout;
        this.unit    = unit;
        bootstrap.setOption("connectTimeoutMillis", unit.toMillis(timeout));
    }
428177
function modalDialog_waitForDialog(aTimeout) {
    var timeout = aTimeout || TIMEOUT_MODAL_DIALOG;

    if (!this._observer) {
      return;
    }

    try {
      mozmill.utils.waitFor(function () {
        return this.finished;
      }, "Modal dialog has been found and processed", timeout, undefined, this);

      // Forward the raised exception so we can detect failures in modal dialogs
      if (this._observer.exception) {
        throw this._observer.exception;
      }
    }
    finally {
      this.stop();
    }
  }
830724
protected void waitForCommand(ITimerCallback callback, long timeout) throws WidgetTimeoutException {
		WaitForConditionTimer t = new WaitForConditionTimer(getByLocator(), callback);
		t.waitUntil(timeout);
	}
1200100
@Override
  public void onTimer(String timerName) {
    if (timerName.equals(IDLE_SESSION_TIMER_NAME)) {
      checkIdleAppSession();
    }
    else if (timerName.equals(TIMER_NAME_TS)) {
      try {
        sendAndStateLock.lock();
        sessionData.setTsTimerId(null);
        handleEvent(new Event(TIMEOUT_EXPIRES, null));
      }
      catch (Exception e) {
        logger.debug("Can not handle event", e);
      }
      finally {
        sendAndStateLock.unlock();
      }
    }
    else {
      logger.warn("Received an unknown timer '{}' for Session-ID '{}'", timerName, getSessionId());
    }
  }
188459
public void processDialogTimeout(final DialogTimeoutEvent timeoutEvent) {
		final Dialog dialog = timeoutEvent.getDialog();
		if(logger.isDebugEnabled()) {
			logger.info("dialog timeout " + dialog + " reason => " + timeoutEvent.getReason());
		}
		if(timeoutEvent.getReason() == Reason.AckNotReceived) {
			final TransactionApplicationData tad = (TransactionApplicationData) dialog.getApplicationData();
			if(tad != null && tad.getSipServletMessage() != null) {
				// https://github.com/RestComm/sip-servlets/issues/107 guard against NPEon concurrent cleanup
				final SipServletMessageImpl sipServletMessage = tad.getSipServletMessage();
				final MobicentsSipSessionKey sipSessionKey = sipServletMessage.getSipSessionKey();
				final MobicentsSipSession sipSession = sipServletMessage.getSipSession();
				getAsynchronousExecutor().execute(new Runnable() {
					public void run() {
						if(logger.isDebugEnabled()) {
							logger.info("Running process dialog timeout " + dialog + " reason => " + timeoutEvent.getReason());
						}
						try {
							if(sipSession != null) {
								SipContext sipContext = findSipApplication(sipSessionKey.getApplicationName());
								//the context can be null if the server is being shutdown
								if(sipContext != null) {
									MobicentsSipApplicationSession sipApplicationSession = sipSession.getSipApplicationSession();
									try {
										sipContext.enterSipApp(sipApplicationSession, sipSession, false, true);
										checkForAckNotReceived(sipServletMessage);
										checkForPrackNotReceived(sipServletMessage);
									} finally {
										sipContext.exitSipApp(sipApplicationSession, sipSession);
									}
									// Issue 1822 http://code.google.com/p/mobicents/issues/detail?id=1822
									// don't delete the dialog so that the app can send the BYE even after the noAckReceived has been called
									//								dialog.delete();
									tryToInvalidateSession(sipSessionKey, false);
								}
							}
							tad.cleanUp();
							tad.cleanUpMessage();
							dialog.setApplicationData(null);
						} catch (Exception e) {
							logger.error("Problem handling dialog timeout", e);
						}
					}
				});
			} else{
				dialog.setApplicationData(null);
			}
		} else {
			dialog.setApplicationData(null);
		}
	}
654221
@Override
	public boolean onActivityTimeout() throws Exception
    {
    	try
    	{
    		send(new PingQuery());
    		return false;
    	}
    	catch (Exception e)
    	{
    		log.warn("#"+id+" cannot send ping to server : "+e.toString());
    		return true;
    	}
    }
1258075
@BackendProperty
    public void setQueryTimeout(Integer seconds) {
        if (seconds != null && seconds.intValue() < 0) {
            throw new IllegalArgumentException("invalid seconds: " + seconds);
        }
        this.queryTimeout = seconds;
    }
1018761
void timerLoop() throws ResourceException
    {
        final String methodName = "timerLoop";
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
        {
            SibTr.entry(this, TRACE, methodName);
        }

        checkMEs(getMEsToCheck());

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
        {
            SibTr.exit(TRACE, methodName);
        }
    }