Record a prepare operation timeout.

@param failedOperation the prepared operation
518503
void recordOperationPrepareTimeout(final BlockingQueueOperationListener.FailedOperation<ServerOperation> failedOperation) {
        recordPreparedTask(new ServerTaskExecutor.ServerPreparedResponse(failedOperation));
        // Swap out the submitted task so we don't wait for the final result. Use a future the returns
        // prepared response
        ServerIdentity identity = failedOperation.getOperation().getIdentity();
        AsyncFuture<OperationResponse> finalResult = failedOperation.getFinalResult();
        synchronized (submittedTasks) {
            submittedTasks.put(identity, new ServerTaskExecutor.ExecutedServerRequest(identity, finalResult));
        }
    }
1331499
def on_failure(self, exc, task_id, args, kwargs, einfo):
        """"""
        super().on_failure(exc, task_id, args, kwargs, einfo)
        if isinstance(exc, OperationRunDoesNotExist):
            return
        self._operation_run.on_failure()
94021
@Deprecated
    protected Statement withPotentialTimeout(FrameworkMethod method,
                                             Object test, Statement next) {
        long timeout = getTimeout(method.getAnnotation(Test.class));
        return timeout > 0 ? new FailOnTimeout(next, timeout) : next;
    }
482200
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSString id_validator = new MPSString();
		id_validator.validate(operationType, id, "\"id\"");
		
		MPSString date_format_validator = new MPSString();
		date_format_validator.validate(operationType, date_format, "\"date_format\"");
		
		MPSString timezone_validator = new MPSString();
		timezone_validator.validate(operationType, timezone, "\"timezone\"");
		
	}
89936
def _declareTimeoutExceeded(self, ev_data: RestartLogData):
        
        logger.info("Timeout exceeded for {}".format(ev_data.when))
        last = self._actionLog.last_event
        if (last and last.ev_type == RestartLog.Events.failed and
                last.data == ev_data):
            return None

        self._action_failed(ev_data,
                            reason="exceeded restart timeout")

        self._unscheduleAction()
        self._actionFailedCallback()
1003593
public void performOpsAction(final Connection c, final long clientHandle, final OpsSelector selector,
            final ParameterSet params) throws Exception
    {
        m_es.submit(new Runnable() {
            @Override
            public void run() {
                try {
                    collectStatsImpl(c, clientHandle, selector, params);
                } catch (Exception e) {
                    hostLog.warn("Exception while attempting to collect stats", e);
                    // ENG-14639, prevent clients like sqlcmd from hanging on exception
                    sendErrorResponse(c, ClientResponse.OPERATIONAL_FAILURE,
                            "Failed to get statistics (" + e.getMessage() + ").",
                            clientHandle);
                }
            }
        });
    }
930932
private void closeQueue(Throwable causingException) {
        // Close the operation queue and extract any outstanding Operations from it.
        Collection<CompletableOperation> remainingOperations = this.operationQueue.close();
        if (remainingOperations != null && remainingOperations.size() > 0) {
            // If any outstanding Operations were left in the queue, they need to be failed.
            // If no other cause was passed, assume we are closing the queue because we are shutting down.
            Throwable failException = causingException != null ? causingException : new CancellationException();
            cancelIncompleteOperations(remainingOperations, failException);
        }

        // The commit queue will auto-close when we are done and it itself is empty. We just need to unblock it in case
        // it was idle and waiting on a pending take() operation.
        this.commitQueue.cancelPendingTake();
    }
859537
public static TransactionalProtocolClient.PreparedOperation<TransactionalProtocolClient.Operation> executeBlocking(final ModelNode operation, TransactionalProtocolClient client) throws IOException, InterruptedException {
        final BlockingQueueOperationListener<TransactionalProtocolClient.Operation> listener = new BlockingQueueOperationListener<>();
        client.execute(listener, operation, OperationMessageHandler.DISCARD, OperationAttachments.EMPTY);
        return listener.retrievePreparedOperation();
    }
218862
@Override
  public void setRequestTimeout(BindingProvider bindingProvider, int timeout) {
    // Production App Engine
    bindingProvider.getRequestContext().put(PRODUCTION_REQUEST_TIMEOUT_KEY, timeout);
    // Dev App Engine
    bindingProvider.getRequestContext().put(DEVEL_REQUEST_TIMEOUT_KEY, timeout);
  }
268937
public Operation<R, M> waitFor(RetryOption... waitOptions) throws SpannerException {
    if (isDone()) {
      return this;
    }
    RetrySettings waitSettings =
        RetryOption.mergeToSettings(DEFAULT_OPERATION_WAIT_SETTINGS, waitOptions);
    try {
      com.google.longrunning.Operation proto =
          RetryHelper.poll(
              new Callable<com.google.longrunning.Operation>() {
                @Override
                public com.google.longrunning.Operation call() throws Exception {
                  return rpc.getOperation(name);
                }
              },
              waitSettings,
              new BasicResultRetryAlgorithm<com.google.longrunning.Operation>() {
                @Override
                public boolean shouldRetry(
                    Throwable prevThrowable, com.google.longrunning.Operation prevResponse) {
                  if (prevResponse != null) {
                    return !prevResponse.getDone();
                  }
                  if (prevThrowable instanceof SpannerException) {
                    SpannerException spannerException = (SpannerException) prevThrowable;
                    return spannerException.getErrorCode() != ErrorCode.NOT_FOUND
                        && spannerException.isRetryable();
                  }
                  return false;
                }
              },
              clock);
      return Operation.create(rpc, proto, parser);
    } catch (InterruptedException e) {
      throw SpannerExceptionFactory.propagateInterrupt(e);
    } catch (ExecutionException e) {
      Throwable cause = e.getCause();
      if (cause instanceof SpannerException) {
        SpannerException spannerException = (SpannerException) cause;
        if (spannerException.getErrorCode() == ErrorCode.NOT_FOUND) {
          return null;
        }
        throw spannerException;
      }
      if (cause instanceof PollException) {
        throw SpannerExceptionFactory.newSpannerException(
            ErrorCode.DEADLINE_EXCEEDED, "Operation did not complete in the given time");
      }
      throw SpannerExceptionFactory.newSpannerException(cause);
    }
  }
1137492
protected void recordFailureMetrics(PolicyFailure failure) {
        requestMetric.setResponseCode(failure.getResponseCode());
        requestMetric.setFailure(true);
        requestMetric.setFailureCode(failure.getFailureCode());
        requestMetric.setFailureReason(failure.getMessage());
    }
1096226
private void retryInit() throws GeomajasException {
		// do not hammer the service
		long now = System.currentTimeMillis();
		if (now > lastInitRetry + cooldownTimeBetweenInitializationRetries) {
			lastInitRetry = now;
			try {
				log.debug("Retrying to (re-)initialize layer {}", getId());
				postConstruct();
			} catch (Exception e) { // NOSONAR
				log.warn("Failed initializing layer: ", e.getMessage());
			}
		}
		if (!usable) {
			throw new GeomajasException(ExceptionCode.LAYER_CONFIGURATION_PROBLEM);
		}
	}
834682
public void operationEnded(InvokeImpl tcInvokeRequestImpl) {
        try {
            this.dialogLock.lock();
            // this op died cause of timeout, TC-L-CANCEL!
            int index = getIndexFromInvokeId(tcInvokeRequestImpl.getInvokeId());
            freeInvokeId(tcInvokeRequestImpl.getInvokeId());
            this.operationsSent[index] = null;
            // lets call listener
            // This is done actually with COmponentIndication ....
        } finally {
            this.dialogLock.unlock();
        }
    }
423723
@Override
   void processModelNode(OperationContext context, ModelNode counter,
         CounterConfiguration.Builder builder) throws OperationFailedException {
      super.processModelNode(context, counter, builder);

      ModelNode upperBoundModel = counter.get(ModelKeys.UPPER_BOUND);
      ModelNode lowerBoundModel = counter.get(ModelKeys.LOWER_BOUND);
      if (lowerBoundModel.isDefined()) {
          Long lowerBound = StrongCounterResource.LOWER_BOUND.resolveModelAttribute(context, counter).asLong();
          builder.lowerBound(lowerBound);
      }
      if (upperBoundModel.isDefined()) {
          Long upperBound = StrongCounterResource.UPPER_BOUND.resolveModelAttribute(context, counter).asLong();
          builder.upperBound(upperBound);
      }
   }
863283
def _send_timer_failed(self, fail):
        
        log.warning('_send_timer_failed:%r: %s', fail,
                    fail.getBriefTraceback())
        self._sendLooperD = self._sendLooper.start(
            self.batch_every_t, now=False)
763095
private void handleTimeoutError(Status status) {
    Preconditions.checkArgument(status.getCause() instanceof StreamWaitTimeoutException,
        "status is not caused by a StreamWaitTimeoutException");
    StreamWaitTimeoutException e = ((StreamWaitTimeoutException) status.getCause());

    // Cancel the existing rpc.
    rpcTimerContext.close();
    failedCount++;

    // Can this request be retried
    int maxRetries = retryOptions.getMaxScanTimeoutRetries();
    if (retryOptions.enableRetries() && ++timeoutRetryCount <= maxRetries) {
      LOG.warn("The client could not get a response in %d ms. Retrying the scan.",
          e.getWaitTimeMs());

      resetStatusBasedBackoff();
      performRetry(0);
    } else {
      LOG.warn("The client could not get a response after %d tries, giving up.",
          timeoutRetryCount);
      rpc.getRpcMetrics().markFailure();
      finalizeStats(status);
      setException(getExhaustedRetriesException(status));
    }
  }
1258149
public void setTimeout(ScheduledExecutorService timeoutExecutor, long timeout, TimeUnit unit) {
      cancelTimeoutTask();
      ScheduledFuture<Void> timeoutFuture = timeoutExecutor.schedule(this, timeout, unit);
      setTimeoutFuture(timeoutFuture);
   }