@param string             $poolKey
@param string             $operation
@param CachePoolException $exception

@throws PoolFailedException
516676
private function handleException($poolKey, $operation, CachePoolException $exception)
    {
        if (!$this->options['skip_on_failure']) {
            throw $exception;
        }

        $this->log(
            'warning',
            sprintf('Removing pool "%s" from chain because it threw an exception when executing "%s"', $poolKey,
                $operation),
            ['exception' => $exception]
        );

        unset($this->pools[$poolKey]);
    }
594630
@Override
	public OperationResult<R> tryOperation(Operation<CL, R> operation) throws ConnectionException {
	    Operation<CL, R> filteredOperation = config.getOperationFilterFactory().attachFilter(operation);
	    
        while (true) {
            attemptCounter++;
            
            try {
                connection = borrowConnection(filteredOperation);
                startTime = System.currentTimeMillis();
                OperationResult<R> result = connection.execute(filteredOperation);
                result.setAttemptsCount(attemptCounter);
                monitor.incOperationSuccess(getCurrentHost(), result.getLatency());
                return result;
            }
            catch (Exception e) {
                ConnectionException ce = (e instanceof ConnectionException) ? (ConnectionException) e
                        : new UnknownException(e);
            	try {
            		informException(ce);
                    monitor.incFailover(ce.getHost(), ce);
            	}
            	catch (ConnectionException ex) {
                    monitor.incOperationFailure(getCurrentHost(), ex);
                    throw ex;
            	}
            }
            finally {
            	releaseConnection();
            }
        }
    }
1184513
protected PoolWaitFuture<E> createFuture(final PoolKey<K> key) {
		return new PoolWaitFuture<E>(lock) {
			protected E getPoolObject(long timeout, TimeUnit unit) throws IOException, InterruptedException, TimeoutException {
				return getBlockingUntilAvailableOrTimeout(key, timeout, unit, this);
			}
		};
	}
1196897
@Override
  public V getFailure(K key, StoreAccessException e) {
    try {
      return loaderWriter.load(key);
    } catch (Exception e1) {
      throw ExceptionFactory.newCacheLoadingException(e1, e);
    } finally {
      cleanup(key, e);
    }
  }
1123347
public void setCache(String cacheName, String cacheKey, Object object) {
        Cache cache = cacheManager.getCache(cacheName);
        if (cache == null) {
            return;
        }
        cache.put(new Element(cacheKey, object));
    }
975059
public void runQueryOperation(Object operation, SimpleCompletableFuture resultFuture) {
        long commitIndex = state.commitIndex();
        Object result = raftIntegration.runOperation(operation, commitIndex);
        resultFuture.setResult(result);
    }
1157074
private function tryAcquire($operation, $lock_type)
    {
        $log_data = [
            "lock_file" => $this->lock_file,
            "lock_type" => $lock_type
        ];

        if (!$this->flock($operation)) {
            $this->logger->debug("could not acquire {lock_type} lock on {lock_file}", $log_data);

            throw new RuntimeException(
                "Could not acquire $lock_type lock on {$this->lock_file}"
            );

        }

        $this->logger->debug("{lock_type} lock acquired on {lock_file}", $log_data);
    }
578584
public function addAsynPool($name, AsynPool $pool, $isRegister = false)
    {
        if (key_exists($name, $this->asynPools)) {
            throw new Exception('pool key is exists!');
        }
        $this->asynPools[$name] = $pool;
        if ($isRegister && $this->asynPoolManager) {
            $pool->workerInit($this->server->worker_id ?? 0);
            $this->asynPoolManager->registerAsyn($pool);
        }

        return $this;
    }
379239
@Override
    public <K, V, R> R invoke(Cache<K, V> cache, Operation<K, V, R> operation, Flag... allFlags) {
        Flag[] attemptFlags = null;
        // attemptFlags = allFlags - Flag.FAIL_SILENTLY
        if ((allFlags != null) && (allFlags.length > 0)) {
            Set<Flag> flags = EnumSet.noneOf(Flag.class);
            flags.addAll(Arrays.asList(allFlags));
            flags.remove(Flag.FAIL_SILENTLY);
            attemptFlags = flags.toArray(new Flag[flags.size()]);
        }

        Exception exception = null;

        for (int i = 0; i <= this.backOffIntervals.length; ++i) {
            // Make sure Flag.FAIL_SILENTLY, if specified, is applied to the last try only
            try {
                return this.invoker.invoke(cache, operation, (i < this.backOffIntervals.length) ? attemptFlags : allFlags);
            } catch (TimeoutException e) {
                exception = e;
            }

            if (i < this.backOffIntervals.length) {
                int delay = this.backOffIntervals[i];

                try {
                    if (ROOT_LOGGER.isTraceEnabled()) {
                        ROOT_LOGGER.tracef(exception, "Cache operation failed.  Retrying in %d ms", Integer.valueOf(delay));
                    }

                    Thread.sleep(delay);
                } catch (InterruptedException e) {
                    Thread.currentThread().interrupt();
                }
            }
        }

        throw MESSAGES.abortingCacheOperation(exception, this.backOffIntervals.length + 1);
    }
133493
@Override
    public Object faultOnKey(EJBCache cache, Object key)
                    throws FaultException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.entry(tc, "faultOnKey", key);

        ByteArray wrapperKey = (ByteArray) key;
        EJSWrapperCommon result = null; // f111627

        // Check if the beanId is already set on this key in which case
        // we can avoid the deserialize
        BeanId beanId = wrapperKey.getBeanId();

        try
        {
            if (beanId == null) {
                beanId = BeanId.getBeanId(wrapperKey, container); // d140003.12
            }
            result = container.createWrapper(beanId);
        } catch (InvalidBeanIdException ex)
        {
            FFDCFilter.processException(ex, CLASS_NAME + ".faultOnKey", "533", this);

            // If the nested exception is an EJBNotFoundException, then report
            // that the app is not started/installed, rather than just the
            // generic 'Malformed object key'.                            d356676.1
            Throwable cause = ex.getCause();
            if (cause instanceof EJBNotFoundException)
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                    Tr.event(tc, "Application Not Started", ex);
                throw new FaultException((EJBNotFoundException) cause,
                                "Application not started or not installed");
            }
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                Tr.event(tc, "Malformed object key", ex);
            throw new FaultException(ex, "Malformed object key");
        } catch (Exception ex)
        {
            FFDCFilter.processException(ex, CLASS_NAME + ".faultOnKey", "548", this);
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                Tr.event(tc, "Malformed object key", ex);
            throw new FaultException(ex, "Malformed object key");
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.exit(tc, "faultOnKey");

        return result;
    }
381908
public function delete($key, $partition = null)
    {
        if (!$this->connected) {
            throw new CacheException('Cache not connected');
        }
        if (!$partition) {
            $partition = $this->namespace;
        }
        $key = $this->addNamespace($key, $partition);
        if (!$this->memcache->delete($key.'_meta')) {
            throw new CacheException('Could not delete cache key');
        }
    }
920640
public static void checkConnectionException(SQLException exception,
      MariaDbConnection connection) {
    if (exception.getSQLState() != null) {
      SqlStates state = SqlStates.fromString(exception.getSQLState());
      if (SqlStates.CONNECTION_EXCEPTION.equals(state)) {
        connection.setHostFailed();
        if (connection.pooledConnection != null) {
          connection.pooledConnection.fireConnectionErrorOccured(exception);
        }
      }
    }
  }
652885
private PooledConnection createPooledConnection(JDBCConnection connection)
    throws SQLException {

        LifeTimeConnectionWrapper connectionWrapper =
            new LifeTimeConnectionWrapper(connection, this.connectionDefaults);
        JDBCPooledConnection pooledConnection =
            new JDBCPooledConnection(connectionWrapper);

        connectionWrapper.setPooledConnection(pooledConnection);

        return pooledConnection;
    }
322303
public function createItemPool($poolOffset, DataStructures\Config $poolConfig)
    {
        $adapterClassName = '\O2System\Cache\Adapters\\' . ucfirst($poolConfig->adapter) . '\ItemPool';

        if (class_exists($adapterClassName)) {
            $adapter = new $adapterClassName($poolConfig);

            if ($adapter instanceof AbstractAdapter) {
                if ($adapter->isSupported()) {
                    $this->register($adapter, $poolOffset);
                }
            }
        }
    }
882928
private void executeQuery(
      long index,
      long sequence,
      long timestamp,
      RaftSession session,
      PrimitiveOperation operation,
      CompletableFuture<OperationResult> future) {
    // If the service has been deleted then throw an unknown service exception.
    if (deleted) {
      log.warn("Service {} has been deleted by another process", serviceName);
      future.completeExceptionally(new RaftException.UnknownService("Service " + serviceName + " has been deleted"));
      return;
    }

    // If the session is not open, fail the request.
    if (!session.getState().active()) {
      log.warn("Inactive session: " + session.sessionId());
      future.completeExceptionally(new RaftException.UnknownSession("Unknown session: " + session.sessionId()));
      return;
    }

    // Otherwise, sequence the query.
    sequenceQuery(index, sequence, timestamp, session, operation, future);
  }
1212265
public void initializeCache(Object key) throws Exception {
		this.sortedWindows = cachedSortedWindows.get(key);
		if (sortedWindows == null) {
			this.sortedWindows = new TreeSet<>();
			Iterator<Map.Entry<W, W>> keyValues = mapping.iterator();
			if (keyValues != null) {
				while (keyValues.hasNext()) {
					Map.Entry<W, W> keyValue = keyValues.next();
					this.sortedWindows.add(keyValue.getKey());
				}
			}
			cachedSortedWindows.put(key, sortedWindows);
		}
	}
1078545
public function execute(\Amp\Artax\Request $request, \ArtaxServiceBuilder\Operation $operation) {
        $originalRequest = clone $request;
        $cachingHeaders = $this->responseCache->getCachingHeaders($request);
        $request->setAllHeaders($cachingHeaders);
        $promise = $this->client->request($request);
        $response = \Amp\wait($promise, $this->reactor);

        if ($response) {
            $operation->setResponse($response);
            $operation->setOriginalResponse($response);
        }

        if ($operation->shouldResponseBeCached($response)) {
            $this->responseCache->storeResponse($originalRequest, $response);
        }

        if ($operation->shouldUseCachedResponse($response)) {
            $cachedResponse = $this->responseCache->getResponse($originalRequest);
            if ($cachedResponse) {
                $response = $cachedResponse;
                $operation->setResponse($response);
            }
            //@TODO This code should only be reached if the cache entry was deleted
            //so throw an exception? Or just leave the 304 to error?
        }

        $exception = $operation->translateResponseToException($response);

        if ($exception) {
            throw $exception;
        }

        return $response;
    }